应网友的要求,写个关于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. saltstack二

    配置管理 haproxy的安装部署 haproxy各版本安装包下载路径https://www.haproxy.org/download/1.6/src/,跳转地址为http,改为https即可 创建相 ...

  2. python数据结构算法学习自修第一天【数据结构与算法引入】

    1.算法引入: #!/usr/bin/env python #! _*_ coding:UTF-8 _*_ from Queue import Queue import time que = Queu ...

  3. Lodop打印html数字间隔不一致

    在font-size属性控制数字大小的时候,可能会出现数字间隔有问题,间隔不一致,可尝试用其他字体大小试试,一般字体越小,越可能出现问题. 如图,前两个打印项都是form1,样式一个是style1,一 ...

  4. codeforces525B

    Pasha and String CodeForces - 525B Pasha got a very beautiful string s for his birthday, the string ...

  5. P1035 调和级数

    两种解法如下: 1.模拟 这种做法的思路是枚举n从1开始,直到Sn>k结束,只需要一个循环即可实现. 代码: #include<cstdio> int main() { ; scan ...

  6. Android 下载App

    转载:http://blog.csdn.net/aicpzl/article/details/52993074 通过DownloadManager来下载APK到本地,下载完成后收到广播再安装APK,可 ...

  7. Codeforces1065F Up and Down the Tree 【树形DP】

    推荐一道联赛练习题. 题目分析: 你考虑进入一个子树就可能上不来了,如果上得来的话就把能上来的全捡完然后走一个上不来的,所以这就是个基本的DP套路. 代码: #include<bits/stdc ...

  8. 「AC自动机」学习笔记

    AC自动机(Aho-Corasick Automaton),虽然不能够帮你自动AC,但是真的还是非常神奇的一个数据结构.AC自动机用来处理多模式串匹配问题,可以看做是KMP(单模式串匹配问题)的升级版 ...

  9. 【XSY2523】神社闭店之日 莫比乌斯反演

    题目大意 给你\(a_1\ldots a_n,l,c\)每次给你\(x,y\),求有多少个序列满足:长度\(\leq l\),每个元素是\([1,c]\),循环右移\(a_j(x\leq j\leq ...

  10. 【比赛】NOIP2018 旅行

    发现 \(m\) 只有两种取值,于是可做了 树的直接贪心 图的枚举环上的边去掉,然后做树的贪心,搜的时候剪一下枝吧 写得有点乱 #include<bits/stdc++.h> #defin ...