Master配置
------------ solrconfig.xml ----------
<requestHandlername="/replication" class="solr.ReplicationHandler" >
<!--
To enable simple master/slavereplication, uncomment one of the
sections below, depending on whetherthis solr instance should be
the "master" or a"slave". If this instance is a"slave" you will
also need to fill in the masterUrl topoint to a real machine.
-->
<lst name="master">
<strname="replicateAfter">commit</str>
<strname="replicateAfter">startup</str>
<strname="confFiles">schema.xml,stopwords.txt,elevate.xml</str>
<strname="commitReserveDuration">00:00:10</str>
<str name="maxNumberOfBackups">1</str>
</lst>
</requestHandler>
Slaver配置
------------ solrconfig.xml ----------
<requestHandlername="/replication" class="solr.ReplicationHandler" >
<!--
To enable simple master/slavereplication, uncomment one of the
sections below, depending on whetherthis solr instance should be
the "master" or a"slave". If this instance is a"slave" you will
also need to fill in the masterUrl topoint to a real machine.
-->
<lst name="slave">
<strname="masterUrl">http://10.101.1.xxx:8080/solr/[core-name]</str>
<strname="pollInterval">00:00:60</str>
<strname="compression">internal</str>
<strname="httpConnTimeout">5000</str>
<strname="httpReadTimeout">10000</str>
</lst>
</requestHandler>
Master和Slave可以配置在一台Web服务下,也可以在不同机器的Web服务下。配置好后,重启(tomcat)服务就可以生效,Slave将自动按照配置的轮询间隔(‘pollInterval’)向Master轮询,如果Master索引发生了变化,将自动进行同步(复制)。
进入从库(slave)链接的管理界面的replication页面,可以看到下一次复制轮询的倒计时,复制状态,并可进行相关的操作等。
http://10.101.1.xxx:8080/solr/#/[core-name]/replication