solrCloud
Posted paulversion
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了solrCloud相关的知识,希望对你有一定的参考价值。
(1) 解压
zookeeper 安装包
tar -zxvf zookeeper-3.4.6.tar.gz
(2)创建data和logs目录
创建目录并赋于写权限
指定zookeeper的数据存放目录和日志目录
(3)拷贝zookeeper
配制文件zoo_sample.cfg,文件在conf目录下
拷贝zookeeper配制文件zoo_sample.cfg并重命名zoo.cfg
(4) 修改zoo.cfg
zoo.cfg配制完后如下:
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/zookeeper/data
dataLogDir=/usr/local/zookeeper/logs
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=192.168.98.202:2888:3888
server.2=192.168.98.203:2888:3888
server.3=192.168.98.204:2888:3888
(5)进入data
文件夹建立对应的myid文件
(6)拷贝zookeeper
文件夹到其他机器
3:配置solr(各个solr节点一样)(单节点)
(1) 将solr-6.0.0\server\solr-webapp目录下的webapp文件夹拷贝到tomcat8下webapps下,并改名为solr。
(2) 修改apache-tomcat-9.0.0.M4\webapps\solr\WEB-INF目录下的web.xml文件修改指定solrhome的位置
(3) 把solr目录下的server/sole复制到solrhome
cp -r /home/hadoop/app/solr-6.0.0/server/solr ~/data/solrhome
(4) 在solrhome下创建solrcore,复制solr-6.0.0/example/example-DIH/solr文件生成solrcore
cp -r ~/app/solr-6.0.0/server/solr/configsets/sample_techproducts_configs ~/data/solrhome/core1
(5) 将solr-6.0.0\server\lib\ext目录下的所有jar包拷贝到tomcat -> webapps -> solr -> WEB-INF -> lib
cp ~/app/solr-6.0.0/server/lib/ext/* ~/app/apache-tomcat-9.0.0.M4/webapps/solr/WEB-INF/lib
(6)将solr-6.0.0\server\resources目录下的log4j.properties文件拷贝到apache-tomcat\webapps\solr\WEB-INF\classes下,classes文件不存在则创建一个
mkdir ~/app/apache-tomcat-9.0.0.M4/webapps/solr/WEB-INF/classes
cp ~/app/solr-6.0.0/server/resources/log4j.properties ~/app/apache-tomcat-9.0.0.M4/webapps/solr/WEB-INF/classes
(7) 启动tomcat,访问solr
app/apache-tomcat-9.0.0.M4/bin/startup.sh
http://192.168.98.201:8080/solr/index.html#/
4:配置solr服务
(1) 在solr下,上传相关信息至zookeeper
在/home/hadoop/app/solr-6.0.0/server/scripts/cloud-scripts/目录下执行
./zkcli.sh -zkhost 192.168.98.202:2181,192.168.98.203:2181,192.168.98.204:2181 -cmd upconfig -confdir /home/hadoop/data/solrhome/core1/conf -confname myconf
(2) 每一台solr和zookeeper关联
修改每一台solr的tomcat 的 bin目录下catalina.sh文件中加入DzkHost指定zookeeper服务器地址:
在JAVA_OPTS添加zookeepre地址
JAVA_OPTS="-DzkHost=192.168.98.202:2181,192.168.98.203:2181,192.168.98.204:2181"
(3) 启动每一台solr服务器
(4) 查看tomcat日志
tail -f ~/app/apache-tomcat-9.0.0.M4/logs/catalina.out
在页面上会只看到一个节点是活的,查看文件知道,是使用了solr默认的8983端口
(5) 修改solr启动端口(各个节点的配置一样)
在solrhome下,有一个solr.xml文件,修改其中的内容为:
${host:192.168.98.201}
${jetty.port:8080}
以上是关于solrCloud的主要内容,如果未能解决你的问题,请参考以下文章