您的位置:首页 > 编程语言 > Java开发

solrCloud分布式集群部署(一)

2013-12-23 21:29 183 查看
服务器IP:192.168.100.175

1个zookeeper + 2个tomcat(tomcat1, tomcat2)

模式:1个core,1个shard

最终效果实现:



配置zookeeper,conf/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.       

#设置zookeeper的data路径

dataDir=/opt/solrCloud/zookeeper-3.4.5/data

# the port at which the clients will connect

clientPort=9080

 

启动zookeeper: ./bin/zkServer.sh start

 

配置solr.xml

<coresadminPath="/admin/cores"defaultCoreName="collection1"

host="${host:192.168.100.175}"hostPort="${jetty.port:8080}"

hostContext="${hostContext:solr}"zkClientTimeout="${zkClientTimeout:15000}">

    <core
name="collection1"
instanceDir="collection1" />


</cores>

 

配置tomcat1:在tomcat1的bin/catalina.sh最上面增加:

JAVA_OPTS="

-Dbootstrap_confdir=/opt/solrCloud/tomcat1/solr/collection1/conf

-Dcollection.configName=clusterconf

 -Djetty.port=8080

 -Dhost=192.168.100.175

 -DzkRun

 -DzkHost=localhost:9080

-DnumShards=1"

注意:这边的修改会覆盖solr.xml中的配置。

 

启动tomcat1

 

配置tomcat2:

复制tomcat1一份为tomcat2:cp –r tomcat1/ tomcat2

修改tomcat2的端口为8081

修改solr.xml:

    <coresadminPath="/admin/cores"defaultCoreName="collection1"

host="${host:192.168.100.175}"hostPort="${jetty.port:8081}"

hostContext="${hostContext:solr}"zkClientTimeout="${zkClientTimeout:15000}">

    <core
name="collection1"
instanceDir="collection1" />


</cores>

 

修改bin/catalina.sh,在最上面增加:

JAVA_OPTS="-Djetty.port=8081

            -DzkHost=192.168.100.175:9080"

//注意:这边的修改会覆盖solr.xml中的配置。

 

启动tomcat2.

 

如果有问题需要重新配置,则需要删除zookeeper的数据文件。

OK,SUCCESS。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Java SOLR