How to enable solr replication

Written by: Open Solr Administrator

Solr Replication

The simple way is presented in the clip below:

;

In order to setup secure solr replication, over HTTPS, between two of your opensolr indexes, just make sure to paste the following configurations, in your solrconfig.xml files of your desired master and slave.

Master

 <requestHandler name="/replication" class="solr.ReplicationHandler" >
    <lst name="master">
        <str name="replicateAfter">startup</str>
        <str name="replicateAfter">commit</str>
        <!--If configuration files need to be replicated give the names here, separated by comma -->
        <str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str>
        <str name="maxNumberOfBackups">0</str>
    </lst>
  </requestHandler>

 

Slave   

 <requestHandler name="/replication" class="solr.ReplicationHandler" >
        <lst name="slave">
            <str name="masterUrl">https://SRV.OPENSOLR.COM/SOLR/YOUR_MASTER_INDEX_NAME</str>
            <str name="pollInterval">00:00:5</str>
            <str name="httpBasicAuthUser">a</str>
            <str name="httpBasicAuthPassword">a</str>
         </lst>
    </requestHandler>

Once this is done, please make sure that both your master and your slave are able to see each other.

Click on the Access IP tab and, obviously:

  1. In the master, you would grant access to /replication for the slave server IP (ping SLAVE_SERVER_HOSTNAME in order to find the IP address).
  2. In the slave, you would grant access to /replication for the master server IP (ping MASTER_SERVER_HOSTNAME in order to find the IP address)

For example, let's assume you've setup replication between index. A and A_REPLICA.
Say index A resides in fr.opensolr.com and index A_REPLICA resides in uk2.opensolr.com
Make sure you add the above configurations to the solrconfig.xml files on both accordingly.
Perform ping fr.opensolr.com and ping uk2.opensolr.com in order to find the IP address of the master and the slave.
Grant your IP permissions.
Make sure that the schema.xml is absolutely identical between the two master and the slave.

For more questions, please Contact Us