Solr Master/Slave Configuration

Solr Master/Slave Configuration Solr Master\Slave Configuration for Production Environment









  • The master server receives all updates and all changes (such as inserts, updates, or deletes) are made against a single master server.

  • Changes made on the master are distributed to all the slave servers which service all query requests from the clients.
    This division of labor enables Solr to scale to provide adequate responsiveness to queries against large search volumes.



Solr Master Configuration

  • Add the Replication Request Handler for each core which needs to replicated.


Step 1: Navigate to Master Solr Core I host my Core in Localhost:8983/solr

  • Navigate to the place where the cores are indexed and place the below configuration to the respective index.

  • For Example : I hosted Solr Core in localhost:8983/solr and the repective path is C:\solr 5.1.0\server\solr\cores_conf\


Step 2: Add the Request handler to the respective core which needs to be replicated in the slave

  • Identitfy Which index needs to replicated



  • Edit the SolrConfig.Xml file of the respective index and add the Request handler

  • add the Below Configuration and restart the Solr and verify it in solr admin UI
       <requestHandler name="/replication" class="solr.ReplicationHandler">
    <lst name="master">
    <str name="replicateAfter">optimize</str>
    <str name="backupAfter">optimize</str>
    <str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str>
    <str name="commitReserveDuration">00:00:10</str>
    </lst>
    <int name="maxNumberOfBackups">2</int>
    <lst name="invariants">
    <str name="maxWriteMBPerSec">16</str>
    </lst>
    </requestHandler>






<

Solr slave configuration



Step 1: Navigate to Slave Solr Core I host my Slave Core in Localhost:8060/solr

 

  • Navigate to the place where the cores are indexed and place the below configuration to the respective index.

  • For Example : I hosted Solr Core in localhost:8060/solr and the repective path is D:\SolrSearch\solr-5.1.0\solr-5.1.0\server\solr\cores_conf\
    Which needs to act as slave

  • Edit the SolrConfig.Xml and add the below Configuration and verify the Replication result in Solr Admin UI by selecting the Core and Click the Execute Query in the Query Window


 
<requestHandler name="/replication" class="solr.ReplicationHandler">
<lst name="slave">

<!-- fully qualified url for the replication handler of master. It is
possible to pass on this as a request param for the fetchindex command -->
<str name="masterUrl">http://remote_host:port/solr/core_name/replication</str>

<!-- Interval in which the slave should poll master. Format is HH:mm:ss .
If this is absent slave does not poll automatically.

But a fetchindex can be triggered from the admin or the http API -->

<str name="pollInterval">00:00:20</str>

<!-- THE FOLLOWING PARAMETERS ARE USUALLY NOT REQUIRED-->

<!-- To use compression while transferring the index files. The possible
values are internal|external. If the value is 'external' make sure
that your master Solr has the settings to honor the accept-encoding header.
See here for details: http://wiki.apache.org/solr/SolrHttpCompression
If it is 'internal' everything will be taken care of automatically.
USE THIS ONLY IF YOUR BANDWIDTH IS LOW.
THIS CAN ACTUALLY SLOWDOWN REPLICATION IN A LAN -->
<str name="compression">internal</str>

<!-- The following values are used when the slave connects to the master to
download the index files. Default values implicitly set as 5000ms and
10000ms respectively. The user DOES NOT need to specify these unless the
bandwidth is extremely low or if there is an extremely high latency -->

<str name="httpConnTimeout">5000</str>
<str name="httpReadTimeout">10000</str>

<!-- If HTTP Basic authentication is enabled on the master, then the slave
can be configured with the following -->

<str name="httpBasicAuthUser">username</str>
<str name="httpBasicAuthPassword">password</str>
</lst>
</requestHandler>

  • https://xchangesitecore.com/solr-master-slave-config/ Vikash Raaj

    Comments

    Popular posts from this blog

    Handling Disaster Recovery Plan

    Sitecore Media Library

    Sitecore Aliases for Multi Site