How To Configure Solr Master-Slave Replication

Here is a preferred Solr index replication design. It distributes complete copies of a master index to 1 or2 slave servers. The master server continues to manage updates to the index. All querying is handled by the slaves. This division of labour enables Solr to scale to provide adequate responsiveness to queries against large search volumes.

Setting up replication job requires at least two servers, one being indexing server (master), and the other being request processing server (slave).

General Master Slave Design

The configuration is easy. No change to master server. Here is a sample of slave configuration.

  • Open the file “C:\solr\solr-5.1.0\example\example-DIH\solr\sampleCore\conf\solrconfig.xml”.
  • The only difference is the section for /replication (reference of master instance).
  • In section <requestHandler name=”/replication” class=”solr.ReplicationHandler” >, remove any master like <lst name=”master”>….</lst>
  • In section <requestHandler name=”/replication” class=”solr.ReplicationHandler” >. Add a slave:

<lst name=”slave”>

                    <str name=”masterUrl”>http://127.1.0.0:8983/solr/sampleCore/replication</str&gt;

                    <str name=”pollInterval”>00:00:60</str>

                    <str name=”compression”>internal</str>

                    <str name=”httpConnTimeout”>5000</str>

                    <str name=”httpReadTimeout”>10000</str>

                    <str name=”httpBasicAuthUser”>username</str>

                    <str name=”httpBasicAuthPassword”>password</str>

</lst>

  • Stop the Solr service and restart. The Master and Slave server dashboard will be like this:

master

slave

This entry was posted in Information Technology, Sitecore, Solr and tagged , , , , , , . Bookmark the permalink.

4 Responses to How To Configure Solr Master-Slave Replication

  1. Nicks says:

    Thanks for the nice article.

    I am working with Sitecore 8.2 with XDB and using Solr as a search provider. I have setup Master and Slave instances and configured Cores on both the instances.

    Now I have couple of questions: 1) Which Cores need to be configured on Solr Master instance and which cores need to be configured on Slave. 2) while setting up replication, which Cores need to replicated from Master to Slave.

    Thanks in advance.

    • wenronglexin says:

      Basically nothing need to do with Master instance. You only need to modify the file “solrconfig.xml” on slave instance under the core you’d like to pull the index from the same core on master instance. You can reference my post for the detail of config file change. That’s it. Good luck!

  2. Nicks says:

    Hi,

    I need some more clarification and thanks for your initial reply.

    We have one Master and one Slave. CMS is connected to Master and CD to Slave and I have setup replication between Master and Slave.

    Currently I have configured below mentioned cores in both Master and Slave. So my initial queries:

    1) Do I need to set all the 15 cores in Master and Web? Do we really need sitecore_fxm_web_index (or any other cores related to ‘web’ in Master also.

    2)Do I need to setup replication between all these 15 Cores.

    3) Do I need to set indexing strategy in Web to Manual for all 15 cores.

    Cores I configured are:
    sitecore_web_index
    sitecore_master_index
    sitecore_core_index
    sitecore_analytics_index
    social_messages_web
    social_messages_master
    sitecore_marketing_asset_index_master
    sitecore_marketing_asset_index_web
    sitecore_testing_index
    sitecore_suggested_test_index
    sitecore_fxm_master_index
    sitecore_fxm_web_index
    sitecore_list_index
    sitecore_marketingdefinitions_master
    sitecore_marketingdefinitions_web

  3. wenronglexin says:

    In Slave instance you just need to setup cores related to web as they serve CDs. Basically by looking the index names, any cores without “master” inside, you need create cores for them in Slave and make them replicas of Master instance. You can exclude analytic index as it is used by Processing server only. It looks like your CM is acting as Processing server as well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s