资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

内置jettyserver下solrcloud6.2.1和Zookeeper集群如何安装和配置过程

小编给大家分享一下内置jetty server下solrcloud6.2.1和Zookeeper集群如何安装和配置过程,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

创新互联公司是一家专注于成都网站设计、网站建设与策划设计,阿克陶网站建设哪家好?创新互联公司做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:阿克陶等地区。阿克陶做网站价格咨询:18982081108

环境介绍:
两台虚拟机:192.168.0.1和192.168.0.2
系统和软件版本:centos6.8 zookeeper-3.4.10 solr-6.2.1

一.zookeeper集群安装
下载 zookeeper-3.4.10并解压
# cd /data/solrcloud/
# tar zxvf zookeeper-3.4.10.tar.gz

在zookeeper目录里创建 data和log目录用于存放数据
# cd /data/solrcloud/zookeeper-3.4.10
# mkdir -p data log

拷贝zookeeper的配置文件zoo_sample.cfg为zoo.cfg
# cp conf/zoo_sample.cfg  conf/zoo.cfg

编辑配置文件zoo.cfg,并加入如下内容:
vi conf/zoo.cfg

dataDir=/data/solrcloud/zookeeper-3.4.10/data
dataLogDir=/data/solrcloud/zookeeper-3.4.10/log

server.1=192.168.0.1:2888:3888
server.2=192.168.0.2:2888:3888

保存退出

在zookeeper中的data目录里需要创建myid文件,并写入对应的数字
conf/zoo.cfg里:
server.1对应的机器上写入1
server.2对应的机器上写入2

192.168.0.1上写入1
#cd /data/solrcloud/zookeeper-3.4.10/data
# echo 1 > myid

同理,另外一台写入2:
# echo 2 > myid

分别在两台机器上启动zookeeper集群
# cd /data/solrcloud/zookeeper-3.4.10/bin
# ./zkServer.sh start

查看集群状态
# ./zkServer.sh status

安装成功应该是一个为leader,1个为follower
# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/solrcloud/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: leader

另外一台:
]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/solrcloud/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower

solrcould安装

解压solr-6.2.1.tgz并重命名为solr,然后修改bin目录下的solr.in.sh文件内容:
SOLR_JAVA_MEM="-Xms10G -Xmx10G" (此处根据内存大小做适当修改,本例为10G)
加入ZK_HOST
ZK_HOST="192.168.0.1:2181,192.168.0.2:2181"
去掉 ZK_CLIENT_TIMEOUT 的注释
ZK_CLIENT_TIMEOUT="15000"

配置solr中文分词器
拷贝IKAnalyzer-2016_FS.jar文件到solr/server/solr-webapp/webapp/WEB-INF/lib目录下


创建用于存放上传的配置文件的solrhome目录,然后拷贝配置文件
# mkdir -p /data/solrcloud/solrhome/myconf
# cp -r /data/solrcloud/solr/example/example-DIH/solr/solr/conf  /data/solrcloud/solrhome/myconf

myconf中conf下的solrconfig.xml及managed-schema内容需要修改,具体内容可以参考以下配置:

 managed-schema内容:



  kvUuid
  kvTitle
 
 
   
     
   

   
     
   

 

 
 
 
 
 
 
 
   
     
   

   
     
   

 

 
 
 
 
 
 
 
 
 
 
 
 
   
     
     
   

 

 
   
     
     
   

 

 
 
 
 
 
 
 
 
 
   
     
     
     
     
     
     
   

   
     
     
     
     
     
     
     
   

 

 
   
     
     
     
     
     
     
   

   
     
     
     
     
     
     
     
   

 

 
   
     
     
     
     
     
     
     
     
   

 

 
   
     
     
     
   

   
     
     
     
     
   

 

 
   
     
     
     
     
   

   
     
     
     
     
   

 

 
   
     
   

 

 
   
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 


启动solrcloud
# # cd /data/solrcloud/solr/bin
./solr start -cloud -z 192.168.0.1:2181,192.168.0.2:2181 -p 8080

创建带有三分片和1个副本的topic和chenfeng集合:
./solr create_collection -c topic -shards 3 -replicationFactor 1 -p 8080
./solr create_collection -c chenfeng -shards 3 -replicationFactor 1 -p 8080

进入cloud-scripts目录并上传配置文件到zookeeper:
# cd /data/solrcloud/solr/server/scripts/cloud-scripts
# ./zkcli.sh   -zkhost   192.168.0.1:2281,192.168.0.2:2181  -cmd   upconfig  -confdir  /data/solrcloud/solr/server/solr/configsets/basic_configs/conf -confname  topic
# ./zkcli.sh   -zkhost   192.168.0.1:2281,192.168.0.2:2181  -cmd   upconfig  -confdir  /data/solrcloud/solr/server/solr/configsets/basic_configs/conf -confname  chenfeng

登陆zookeeper集群查看上传的文件:
# cd /data/solrcloud/zookeeper-3.4.10/bin
# ./zkCli.sh
Connecting to localhost:2181
2018-01-25 17:13:33,212 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
2018-01-25 17:13:33,216 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=
2018-01-25 17:13:33,216 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_161
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-3.b14.el6_9.x86_64/jre
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/data/solrcloud/zookeeper-3.4.10/bin/../build/classes:/data/solrcloud/zookeeper-3.4.10/bin/../build/lib/*.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/slf4j-log4j12-1.6.1.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/slf4j-api-1.6.1.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/netty-3.10.5.Final.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/log4j-1.2.16.jar:/data/solrcloud/zookeeper-3.4.10/bin/../lib/jline-0.9.94.jar:/data/solrcloud/zookeeper-3.4.10/bin/../zookeeper-3.4.10.jar:/data/solrcloud/zookeeper-3.4.10/bin/../src/java/lib/*.jar:/data/solrcloud/zookeeper-3.4.10/bin/../conf:
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2018-01-25 17:13:33,218 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-642.el6.x86_64
2018-01-25 17:13:33,219 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2018-01-25 17:13:33,219 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2018-01-25 17:13:33,219 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/data/solrcloud/zookeeper-3.4.10/bin
2018-01-25 17:13:33,220 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@277050dc
Welcome to ZooKeeper!
2018-01-25 17:13:33,240 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2018-01-25 17:13:33,297 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@876] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2018-01-25 17:13:33,305 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x1612c33f9f2000a, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 0] ls /configs
[topic, chenfeng]
[zk: localhost:2181(CONNECTED) 1] ls /configs/topic
[currency.xml, protwords.txt, managed-schema, solrconfig.xml, synonyms.txt, elevate.xml, stopwords.txt, lang, params.json]
[zk: localhost:2181(CONNECTED) 2] ls /configs/chenfeng
[currency.xml, protwords.txt, managed-schema, solrconfig.xml, synonyms.txt, elevate.xml, stopwords.txt, lang, params.json]
[zk: localhost:2181(CONNECTED) 3] quit
Quitting...
2018-01-25 17:13:51,512 [myid:] - INFO  [main:ZooKeeper@684] - Session: 0x1612c33f9f2000a closed
2018-01-25 17:13:51,514 [myid:] - INFO  [main-EventThread:ClientCnxn$EventThread@519] - EventThread shut down for session: 0x1612c33f9f2000a


查看solr集群页面:
http://192.168.0.1:8080/solr/#/~collections/chenfeng
http://192.168.0.1:8080/solr/#/~collections/topic

在界面上点reload重新加载配置文件,然后刷新页面。

以上是“内置jetty server下solrcloud6.2.1和Zookeeper集群如何安装和配置过程”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!


文章名称:内置jettyserver下solrcloud6.2.1和Zookeeper集群如何安装和配置过程
地址分享:http://www.cdkjz.cn/article/iedosp.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220