centos中Solr集群的安装及配置

第一步:Zookeeper集群的搭建http://blog.csdn.net/wenbsu/article/details/60480167


第二步:搭建4个tomcat,并且为每个tomcat部署solr,不会的请参照solr安装及配置http://blog.csdn.net/wenbsu/article/details/60593427

[root@localhost webapps]# cp solr -r ../../solrcloud/tomcat1/webapps/ 
[root@localhost webapps]# cp solr -r ../../solrcloud/tomcat2/webapps/
[root@localhost webapps]# cp solr -r ../../solrcloud/tomcat3/webapps/
[root@localhost webapps]# cp solr -r ../../solrcloud/tomcat4/webapps/

[root@localhost local]# cp -r solrhome /usr/local/solrcloud/solrhome1
[root@localhost local]# cp -r solrhome /usr/local/solrcloud/solrhome2
[root@localhost local]# cp -r solrhome /usr/local/solrcloud/solrhome3
[root@localhost local]# cp -r solrhome /usr/local/solrcloud/solrhome4


[root@bogon solrcloud]# vim tomcat1/webapps/solr/WEB-INF/web.xml


[root@bogon solrcloud]# vim tomcat2/webapps/solr/WEB-INF/web.xml


[root@bogon solrcloud]# vim tomcat3/webapps/solr/WEB-INF/web.xml


[root@bogon solrcloud]# vim tomcat4/webapps/solr/WEB-INF/web.xml



第三步:把solrhome中的配置文件上传到zookeeper集群。使用zookeeper的客户端上传。

客户端命令位置:/root/solr-4.10.3/example/scripts/cloud-scripts


[root@bogon ~]# cd solr-4.10.3/example/scripts/cloud-scripts
[root@bogon cloud-scripts]# pwd
/root/solr-4.10.3/example/scripts/cloud-scripts
[root@bogon cloud-scripts]# ll

-rw-r--r--. 1 root root 317 Dec  1  2014 log4j.properties
-rw-r--r--. 1 root root 707 Dec  1  2014 zkcli.bat
-rwxr-xr-x. 1 root root 485 Dec  1  2014 zkcli.sh
[root@bogon cloud-scripts]# ./zkcli.sh -zkhost 192.168.30.138:2181,192.168.30.138:2182,192.168.30.138:2183 -cmd upconfig -confdir /usr/local/solrcloud/solrhome1/collection1/conf -confname myconf

查看配置文件是否上传成功:

[zk: localhost:2181(CONNECTED) 1] ls /
[configs, zookeeper]
[zk: localhost:2181(CONNECTED) 2] ls /configs
[myconf]
[zk: localhost:2181(CONNECTED) 3] ls /configs/myconf
[admin-extra.menu-top.html, currency.xml, protwords.txt, mapping-FoldToASCII.txt, _schema_analysis_synonyms_english.json, _rest_managed.json, solrconfig.xml, _schema_analysis_stopwords_english.json, stopwords.txt, lang, spellings.txt, mapping-ISOLatin1Accent.txt, admin-extra.html, xslt, scripts.conf, synonyms.txt, update-script.js, velocity, elevate.xml, admin-extra.menu-bottom.html, schema.xml, clustering]

第四步:修改各个solrhome下的solr.xml文件,指定当前实例运行的ip地址及端口号。

[root@bogon solrcloud]# vim solrhome1/solr.xml 


[root@bogon solrcloud]# vim solrhome2/solr.xml 


[root@bogon solrcloud]# vim solrhome3/solr.xml

[root@bogon solrcloud]# vim solrhome4/solr.xml 



第五步:修改每一台solrtomcatbin目录下catalina.sh文件中加入DzkHost指定zookeeper服务器地址: 

JAVA_OPTS="-DzkHost=192.168.30.138:2181,192.168.30.138:2182,192.168.30.138:2183"

(可以使用vim的查找功能查找到JAVA_OPTS的定义的位置,然后添加)

[root@bogon solrcloud]# vim tomcat1/bin/catalina.sh

[root@bogon solrcloud]# vim tomcat2/bin/catalina.sh

[root@bogon solrcloud]# vim tomcat3/bin/catalina.sh

[root@bogon solrcloud]# vim tomcat4/bin/catalina.sh



第六步:重启tomcat,实现一个主节点多个备份节点,集群只有一片。



第七步:

创建一个两片的collection,每片是一主一备。

使用以下命令创建:

http://192.168.30.138:8080/solr/admin/collections?action=CREATE&name=collection2&numShards=2&replicationFactor=2




第八步:

删除collection1.

http://192.168.30.138:8080/solr/admin/collections?action=DELETE&name=collection1



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值