应网友的要求,写个关于Linux单机的

首先,把MySQL驱动包和solr7.1安装包上传到服务器,我上传到了自定义的目录/mysoft

执行服务安装脚本

1. 先切换到root用户

2. 解压出脚本

3. 执行安装命令,注意要把其中的‘taozi’换成你的普通用户名

[taozi@localhost 桌面]$ su root
密码:
[root@localhost mysoft]# tar zxf solr-7.1..tgz solr-7.1./bin/install_solr_service.sh --strip-components=
[root@localhost mysoft]# ./install_solr_service.sh solr-7.1..tgz -i /opt -d /var/solr -u taozi -s solr -p -n Extracting solr-7.1..tgz to /opt Installing symlink /opt/solr -> /opt/solr-7.1. ... Installing /etc/init.d/solr script ... Installing /etc/default/solr.in.sh ... Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh
Not starting Solr service (option -n given). Start manually with 'service solr start'

开启防火墙端口

[root@localhost mysoft]# firewall-cmd --zone=public --add-port=/tcp --permanent
success
[root@localhost mysoft]# systemctl restart firewalld

启动服务(其实我喜欢先配置完毕再启动,这里只是让大家看一下有没有安装成功)

[root@localhost mysoft]# service solr start
Waiting up to seconds to see Solr running on port [/]
Started Solr server on port (pid=). Happy searching!

打开前台:

建立核心

注意要切换到普通用户

[root@localhost mysoft]# cd /opt/solr-7.1./
[root@localhost solr-7.1.]# su taozi
[taozi@localhost solr-7.1.]$ ./bin/solr create -c mycore
WARNING: Using _default configset. Data driven schema functionality is enabled by default, which is
NOT RECOMMENDED for production use. To turn it off:
curl http://localhost:8983/solr/mycore/config -d '{"set-user-property": {"update.autoCreateFields":"false"}}' Created new core 'mycore'

查看界面

人家说没有dataimport-handler,那就配置一个呗。

关闭服务

[taozi@localhost solr-7.1.]$ su root
密码:
[root@localhost solr-7.1.]# service solr stop
Sending stop command to Solr running on port ... waiting up to seconds to allow Jetty process to stop gracefully.

进入solr主目录

[root@localhost solr-7.1.]# cd /var/solr/data/
[root@localhost data]# ll
总用量
drwxrwxr-x. taozi taozi 11月 : mycore
-rw-r-----. taozi taozi 11月 : solr.xml
-rw-r-----. taozi taozi 11月 : zoo.cfg

进入core的conf目录

[root@localhost data]# cd mycore/conf/
[root@localhost conf]# ll
总用量
drwxrwxr-x. taozi taozi 11月 : lang
-rw-rw-r--. taozi taozi 10月 : managed-schema
-rw-rw-r--. taozi taozi 10月 : params.json
-rw-rw-r--. taozi taozi 10月 : protwords.txt
-rw-rw-r--. taozi taozi 10月 : solrconfig.xml
-rw-rw-r--. taozi taozi 10月 : stopwords.txt
-rw-rw-r--. taozi taozi 10月 : synonyms.txt
[root@localhost conf]# su taozi
[taozi@localhost conf]$ vim data-config.xml

新建data-config.xml文件,注意切换普通用户。

添加内容如下:【注意:这个是配置数据库的对应关系的,还有,MySQL数据库仅仅本地访问支持root用户,网络访问需要授权新用户,这里我的数据库用户是非root用户】

<dataConfig>
<dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://192.168.1.112:3306/demo" user="admin" password="admin" />
<document>
<entity name="bless" pk="bless_id"
query="select * from bless"
deltaQuery="select bless_id from bless where bless_time > '${dataimporter.last_index_time}'"
deltaImportQuery="SELECT * FROM bless where bless_id='${dataimporter.delta.bless_id}'">
<field column="BLESS_ID" name="blessId" />
<field column="BLESS_CONTENT" name="blessContent" />
<field column="BLESS_TIME" name="blessTime" />
</entity>
</document>
</dataConfig>

修改solrconfig.xml

[taozi@localhost conf]$ vim solrconfig.xml

 <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>

复制依赖jar包到solr-webapp/webapp/WEB-INF/lib目录下

[taozi@localhost conf]$ su root
密码:
[root@localhost conf]# cd /opt/solr-7.1./dist/
[root@localhost dist]# ll
总用量
-rw-r--r--. root root 10月 : solr-analysis-extras-7.1..jar
-rw-r--r--. root root 10月 : solr-analytics-7.1..jar
-rw-r--r--. root root 10月 : solr-cell-7.1..jar
-rw-r--r--. root root 10月 : solr-clustering-7.1..jar
-rw-r--r--. root root 10月 : solr-core-7.1..jar
-rw-r--r--. root root 10月 : solr-dataimporthandler-7.1..jar
-rw-r--r--. root root 10月 : solr-dataimporthandler-extras-7.1..jar
drwxr-xr-x. root root 11月 : solrj-lib
-rw-r--r--. root root 10月 : solr-langid-7.1..jar
-rw-r--r--. root root 10月 : solr-ltr-7.1..jar
-rw-r--r--. root root 10月 : solr-solrj-7.1..jar
-rw-r--r--. root root 10月 : solr-test-framework-7.1..jar
-rw-r--r--. root root 10月 : solr-uima-7.1..jar
-rw-r--r--. root root 10月 : solr-velocity-7.1..jar
drwxr-xr-x. root root 11月 : test-framework
[root@localhost dist]# cp solr-dataimporthandler-7.1..jar solr-dataimporthandler-extras-7.1..jar /opt/solr-7.1./server/solr-webapp/webapp/WEB-INF/lib/
[root@localhost dist]# cp /mysoft/mysql-connector-java-5.1.-bin.jar /opt/solr-7.1./server/solr-webapp/webapp/WEB-INF/lib/

启动服务

[root@localhost dist]# service solr start

如果还是没显示data-import的配置信息,那么就重启

[root@localhost bin]# service solr restart
Sending stop command to Solr running on port ... waiting up to seconds to allow Jetty process to stop gracefully.
Waiting up to seconds to see Solr running on port [-]
Started Solr server on port (pid=). Happy searching!

这下有了。

建立Schema

分别建立你需要的字段

执行导入

查看

看似没问题了,但是你如果增量导入,就会出现问题,会有重复数据,因为时区相差八小时。

[root@localhost conf]# cat dataimport.properties
#Mon Nov :: UTC
bless.last_index_time=-- \:\:
last_index_time=-- \:\:

解决:【注意:这种方法适用于Linux】

vim /etc/default/solr.in.sh

重启服务,查看时区

[root@localhost conf]# service solr restart
Sending stop command to Solr running on port ... waiting up to seconds to allow Jetty process to stop gracefully.
Waiting up to seconds to see Solr running on port [-]
Started Solr server on port (pid=). Happy searching! [root@localhost conf]# cat dataimport.properties
#Tue Nov :: GMT+08:00
bless.last_index_time=-- \:\:
last_index_time=-- \:\:

这样,增量导入没问题了。

Solr7.1--- 单机Linux环境搭建的更多相关文章

  1. Linux环境搭建-在虚拟机中安装Centos7.0

    最近在空闲时间学习Linux环境中各种服务的安装与配置,都属于入门级别的,这里把所有的学习过程记录下来,和大家一起分享. 我的电脑系统是win7,所以我需要在win7上安装一个虚拟机-VMware,然 ...

  2. 【菜鸟学习Linux】-第三章- Linux环境搭建-使用VMware9安装Ubuntu 12.04系统

    上一步,我们安装了VMware9虚拟机,现在我们就是用它来安装Ubuntu12.04系统,至于Ubuntu是什么,我就不废话了,大家google一下,比我讲的清楚,好了,开始干活! Ubuntu官网下 ...

  3. Windows及Linux环境搭建Redis集群

    一.Windows环境搭建Redis集群 参考资料:Windows 环境搭建Redis集群 二.Linux环境搭建Redis集群 参考资料:Redis Cluster的搭建与部署,实现redis的分布 ...

  4. Kafka单机Windows环境搭建

    Kafka单机Windows环境搭建 1,安装jdk1.8:安装目录不能有中文空格: 2,下载zookeeper,https://mirrors.cnnic.cn/apache/zookeeper/z ...

  5. Linux(一)-- Linux环境搭建

    Linux环境搭建 一.虚拟机安装 1.下载地址 https://my.vmware.com/web/vmware/info/slug/desktop_end_user_computing/vmwar ...

  6. Linux(一)—— Linux环境搭建

    Linux环境搭建 一.虚拟机安装 1.下载地址 https://my.vmware.com/web/vmware/info/slug/desktop_end_user_computing/vmwar ...

  7. Linux环境搭建及基础操作

    一.Linux环境搭建 1.安装虚拟机软件(VMWare,Parallel) 虚拟机的作用:将本来不是适合当前操作系统的分区虚拟化成适合当前操作系统的分区格式 2.新建虚拟机: 类似买了一台新的电脑, ...

  8. 【转】Linux环境搭建FTP服务器与Python实现FTP客户端的交互介绍

    Linux环境搭建FTP服务器与Python实现FTP客户端的交互介绍 FTP 是File Transfer Protocol(文件传输协议)的英文简称,它基于传输层协议TCP建立,用于Interne ...

  9. centos 8 集群Linux环境搭建

    一.集群Linux环境搭建 1. 注意事项 1.1 windows系统确认所有的关于VmWare的服务都已经启动 打开任务管理器->服务,查看五个VM选项是否打开. 1.2 确认好VmWare生 ...

  10. 消息中间件——RabbitMQ(一)Windows/Linux环境搭建(完整版)

    前言 最近在学习消息中间件--RabbitMQ,打算把这个学习过程记录下来.此章主要介绍环境搭建.此次主要是单机搭建(条件有限),包括在Windows.Linux环境下的搭建,以及RabbitMQ的监 ...

随机推荐

  1. WPF如何实现TreeView节点重命名

    我们经常看到一些软件比如酷狗音乐,在对列表右键进行重命名的时候,当前列表会泛白并且进入可编辑状态,当我们更改完成后就会并进入非编辑状态,这些具体是怎么实现的呢?下面的方法也许会提供一些思路,下面的Tr ...

  2. react事件绑定,事件传参,input单向数据绑定

    import React, { Component } from 'react'; class New extends Component { constructor(props){ super(pr ...

  3. mysql分页查询按某类型置顶 按某类型置尾 再按优先级排序

    近段时间接到一个新需求: 第一优先级:未满的标的顺位高于已满标的顺位.第二优先级:新手标的顺位高于其他标的的顺位. 第三优先级:标的剩余可投金额少的顺位高于标的剩余可投金额多的. 我是直接通过sql语 ...

  4. word公式大小

    下面给出MathType与Word对应的字体关系,大家可以根据自己的实际需求,调整自己的公式大小.  MathType与Word对应的字体关系示例 以上给大家详细介绍了调整MathType公式字体大小 ...

  5. linux 安装Brew

    点击查看原文 Linuxbrew:Linux下的Homebrew amendgit 关注 2017.02.16 17:20* 字数 455 阅读 4745评论 0喜欢 2 前不久还在跟同事抱怨ubun ...

  6. Facebook开源最先进的语音系统wav2letter++

    最近,Facebook AI Research(FAIR)宣布了第一个全收敛语音识别工具包wav2letter++.该系统基于完全卷积方法进行语音识别,训练语音识别端到端神经网络的速度是其他框架的两倍 ...

  7. 【NLP】How to Generate Embeddings?

    How to represent words. 0 . Native represtation: one-hot vectors Demision: |all words| (too large an ...

  8. Codeforces Round #419 Div. 1

    A:暴力枚举第一列加多少次,显然这样能确定一种方案. #include<iostream> #include<cstdio> #include<cmath> #in ...

  9. yoj维护

    维护 启动容器 docker start yoj 暂停容器 docker stop yoj 重启容器 docker restart yoj 进入容器的终端 docker attach yok 保存容器 ...

  10. 爬虫_糗事百科(scrapy)

    糗事百科scrapy爬虫笔记 1.response是一个'scrapy.http.response.html.HtmlResponse'对象,可以执行xpath,css语法来提取数据 2.提取出来的数 ...