Solr master-slave backup

SOLR replication mode is an implementation method for synchronizing master-slave servers in a distributed environment. Due to the high deployment cost of the different rsync-based SOLR methods mentioned above, it was replaced by the SOLR1.4 version. It is an index file transfer mechanism based on the HTTP protocol. This method is easy to deploy and only needs to configure one file. The following explains the specific operation steps: The 
steps are divided into the master server and the slave server, and multiple slave servers are allowed, that is, the configuration of the slave servers is the same. 

Master server
In solrConfig.xml: 

Xml code   Favorite code
  1. <requestHandler name="/replication" class="solr.ReplicationHandler">  
  2.          <lst name="master">  
  3.                  <str name="replicateAfter">commit</str>  
  4.                  <str name="confFiles">schema.xml,solrconfig_slave.xml:solrconfig.xml</str>  
  5.                  <str name="commitReserveDuration">00:05:00</str>  
  6.          </lst>  
  7.  </requestHandler>  


illustrate: 

    • replicateAfter : SOLR will perform replication after the following actions occur: 'commit', 'startup' 'optimize', here we choose commit, that is, every time SOLR receives a commit request, it will execute the replication strategy.
    • confFiles : The configuration files to be distributed, solr will also synchronize the field configuration files on the primary server: schema.xml and stopwords.txt, and the fixed file: elevate.xml to the secondary server.
    • commitReserveDuration: After each commit, the cycle time for retaining the incremental index, here is set to 5 minutes.

 



From server: 

Xml code   Favorite code
  1.    
  2. <requestHandler name="/replication" class="solr.ReplicationHandler">  
  3.     <lst name="slave">  
  4.         <str name="masterUrl">http://192.168.172.2:7100/solr/${solr.core.name}/replication</str>  
  5.         <str name="pollInterval">00:08:00</str>  
  6.         <!-- external it is easy to have the wrong index size and the damaged compressed file, which makes the replication impossible, and the replication fails all the time. There is no problem with the internal test -->  
  7.         <str name="compression">internal</str>  
  8.         <str name="httpConnTimeout">1000</str>  
  9.         <str name="httpReadTimeout">2000</str>  
  10.     </lst>  
  11. </requestHandler>  


说明: 

  • masterUrl : 主服务器同步URL地址
  • pollInterval:从服务器同步间隔,即每隔多长时间同步一次主服务器
  • httpConnTimeout:设置连接超时(单位:毫秒)
  • httpReadTimeout:如果设置同步索引文件过大,则应适当提高此值。(单位:毫秒)
  • httpBasicAuthUser:验证用户名,需要和主服务器一致
  • httpBasicAuthPassword:验证密码,需和主服务器一致
  • compression:external or internal use SOLR's own compression algorithm or apply the container's

Official website address: http://wiki.apache.org/solr/SolrReplication

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326225427&siteId=291194637