Solr Jetty Replication

===========================================================
How to build a Solr cluster(One Master, two Slaves)
===========================================================
1. Add below replication handler to solrconfig.xml in the example dir.
<requestHandler name="/replication" class="solr.ReplicationHandler" >
<lst name="master">
<str name="enable">${solr.master.enable:false}</str>
<str name="replicateAfter">startup</str>
<str name="replicateAfter">commit</str>
<str name="confFiles">stopwords.txt</str>
</lst>
<lst name="slave">
<str name="enable">${solr.slave.enable:false}</str>
<str name="masterUrl">
http://SOLRSERVER:8983/solr/collection1/replication
</str>
<str name="pollInterval">00:00:60</str>
</lst>
</requestHandler>
2.
cp -r example example2
cp -r example example3

3.start the servers
cd example  -- this is for master
nohup  java -Xms512M -Xmx1024M -Dfile.encoding=UTF8  -Dsolr.master.enable=true   -jar start.jar &

cd example2 -- this is for slave
nohup java -Xms512M -Xmx1024M -Dfile.encoding=UTF8   -Dsolr.slave.enable=true -Dsolr.data.dir=./cores_data/data8984 -Djetty.port=8984    -jar  start.jar &

cd example3 -- this is for slave
nohup java -Xms512M -Xmx1024M -Dfile.encoding=UTF8   -Dsolr.slave.enable=true -Dsolr.data.dir=./cores_data/data8985 -Djetty.port=8985    -jar  start.jar &

4 check ths status
http://SOLRSERVER:8983/solr/admin/replication/index.jsp
http://SOLRSERVER:8984/solr/admin/replication/index.jsp
http://SOLRSERVER:8985/solr/admin/replication/index.jsp

5. build index into server.
[jk97029@SOLRSERVER exampledocs]$ pwd
/home/jk97029/apache-solr-3.6.0/example/exampledocs
[jk97029@SOLRSERVER exampledocs]$ java -jar post.jar mem.xml
[jk97029@SOLRSERVER exampledocs]$ java -jar post.jar hd.xml

6. check if the docs are added or not.
http://SOLRSERVER:8983/solr/select/?q=id:6H500F0
http://SOLRSERVER:8984/solr/select/?q=id:6H500F0
http://SOLRSERVER:8985/solr/select/?q=id:6H500F0

猜你喜欢

转载自ilnba.iteye.com/blog/1537547