【solr】【zookeeper】【linux】linux下solr7.2.1+tomcat9.0.27+zookeeper3.5.6集群
solr7.2.1下载地址:http://archive.apache.org/dist/lucene/solr/7.2.1/solr-7.2.1.tgz
tomcat9.0.33下载地址:http://mirrors.hust.edu.cn/apache/tomcat/tomcat-9/v9.0.33/bin/apache-tomcat-9.0.33.tar.gz
zookeeper3.5.6下载地址:https://archive.apache.org/dist/zookeeper/zookeeper-3.5.6/apache-zookeeper-3.5.6-bin.tar.gz
tomcat版本不一样问题不大
单机器集群,多机器集群在后面补充,就是与单机的不同点
1、solr+tomcat正常启动
1.1、修改端口
vi /opt/arch_software/tomcat/apache-tomcat-9.0.27-8881/conf/server.xml
修改完之后按ESC,接着:wq保存退出(注意不要漏了冒号)
vi /opt/arch_software/tomcat/apache-tomcat-9.0.27-8882/conf/server.xml
vi /opt/arch_software/tomcat/apache-tomcat-9.0.27-8883/conf/server.xml
1.2、solr的solr-7.2.1/server/solr-webapp下webapp文件夹复制到
创建文件夹
mkdir /opt/arch_software/tomcat/solr/WEB-INF/classes
编辑solr的web.xml
vi /opt/arch_software/tomcat/solr/WEB-INF/web.xml
创建文件夹
mkdir /opt/arch_software/solr
mkdir /opt/arch_software/solr/home1
mkdir /opt/arch_software/solr/home2
mkdir /opt/arch_software/solr/home3
此时启动三个tomcat,能正常访问就可以了。
上面的configsets是单机需要用到,集群了就不用了可以删除
2、zookeeper配置
zoo_sample.cfg修改为zoo.cfg
编辑zoo.cfg
vi /opt/arch_software/apache-zookeeper-3.5.6-bin/conf/zoo.cfg
dataDir=/opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin/zkDatas/data
server.1=10.79.6.87:2888:3888
server.2=10.79.6.87:2889:3889
server.3=10.79.6.87:2890:3890
dataLogDir=/opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin/zkDatas/logs
创建文件夹
mkdir /opt/arch_software/apache-zookeeper-3.5.6-bin/zkDatas
mkdir /opt/arch_software/apache-zookeeper-3.5.6-bin/zkDatas/data
mkdir /opt/arch_software/apache-zookeeper-3.5.6-bin/zkDatas/logs
创建文件
touch /opt/arch_software/apache-zookeeper-3.5.6-bin/zkDatas/data/myid
设置文件内容为1
vi /opt/arch_software/apache-zookeeper-3.5.6-bin/zkDatas/data/myid
创建文件夹
mkdir /opt/arch_software/zookeeper
复制文件夹apache-zookeeper-3.5.6-bin到zookeeper文件夹下
cp -r /opt/arch_software/apache-zookeeper-3.5.6-bin/ /opt/arch_software/zookeeper/
修改文件夹名称
mv /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin1
另外两个也是
cp -r /opt/arch_software/apache-zookeeper-3.5.6-bin/ /opt/arch_software/zookeeper/
mv /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin2
cp -r /opt/arch_software/apache-zookeeper-3.5.6-bin/ /opt/arch_software/zookeeper/
mv /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin3
修改配置文件
vi /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin1/conf/zoo.cfg
vi /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin2/conf/zoo.cfg
vi /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin2/zkDatas/data/myid
vi /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin3/conf/zoo.cfg
vi /opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin3/zkDatas/data/myid
创建文件夹
mkdir /opt/arch_software/solr/cloudhome
cp -r /opt/archConfig/tool/solr-7.2.1/server/solr/configsets/sample_techproducts_configs/conf/ /opt/arch_software/solr/cloudhome/
修改solrhome的端口
vi /opt/arch_software/solr/home1/solr.xml
vi /opt/arch_software/solr/home2/solr.xml
vi /opt/arch_software/solr/home3/solr.xml
修改tomcat的catalina.sh文件
vi /opt/arch_software/tomcat/apache-tomcat-9.0.27-8881/bin/catalina.sh
添加JAVA_OPTS="-DzkHost=10.79.6.87:2181,10.79.6.87:2182,10.79.6.87:2183"注意自己ip
vi /opt/arch_software/tomcat/apache-tomcat-9.0.27-8882/bin/catalina.sh
vi /opt/arch_software/tomcat/apache-tomcat-9.0.27-8883/bin/catalina.sh
启动zookeeper
/opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin1/bin/zkServer.sh start
/opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin2/bin/zkServer.sh start
/opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin3/bin/zkServer.sh start
查看zookeeper启动状态
/opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin1/bin/zkServer.sh status
/opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin2/bin/zkServer.sh status
/opt/arch_software/zookeeper/apache-zookeeper-3.5.6-bin3/bin/zkServer.sh status
停止zookeeper就把后面换成stop,重启就换成restart
把solr配置库上传到zookeeper上(注意自己的solr位置和ip)
/opt/archConfig/tool/solr-7.2.1/server/scripts/cloud-scripts/zkcli.sh -zkhost 10.79.6.87:2181,10.79.6.87:2182,10.79.6.87:2183 -cmd upconfig -confdir /opt/arch_software/solr/cloudhome/conf -confname myconf/
启动tomcat
/opt/arch_software/tomcat/apache-tomcat-9.0.27-8881/bin/startup.sh
/opt/arch_software/tomcat/apache-tomcat-9.0.27-8882/bin/startup.sh
/opt/arch_software/tomcat/apache-tomcat-9.0.27-8883/bin/startup.sh
多机器集群的不同点
每个zookeeper机器都要运行zkcli.sh,具体看上面
效果