Skip to main content

Solr Master/Slave configuration

Index Replication distributes complete copies of a master index to one or more slave servers. The master server continues to manage updates to the index. All querying is handled by the slaves. This division of labor enables Solr to scale to provide adequate responsiveness to queries against large search volumes.




1.   Prerequisite Software 
·         JAVA ( install it from https://java.com/en/download/)
·         NSSM 2.24 ( Non Sucking Service manager) https://nssm.cc/release/nssm-2.24.zip

2.   Setup Solr Instance

           A)   Setup Solr instance for Master 
        ·         Follow below link to setup Solr as Master 

https://www.sitecorebites.net/2019/12/setup-solr-as-window-service.html

              Ex : D:\SolrPOC\Solr\Master\Solr-4.5.1\

 B)   Setup Solr instance for Slave
        ·     Follow below link to setup Solr as Slave
https://www.sitecorebites.net/2019/12/setup-solr-as-window-service.html

          Ex : D:\SolrPOC\Solr\Slave\Solr-4.5.1\

3.   Configuring the ReplicationHandler
      Solr includes a Java implementation of index replication that works over HTTP:

  •     The configuration affecting replication is controlled by a single file, solrconfig.xml
  •     Supports the replication of configuration files as well as index files
  •     Works across platforms with same configuration
  •     No reliance on OS-dependent file system features (eg: hard links)
  •    Tightly integrated with Solr; an admin page offers fine-grained control of each aspect of replication

3.1  Master Solr Configuration : Configuring the Replication RequestHandler on a Master Server
·         For CMS connection master solr configuration required.

-       Master URL : http://localhost:8983/solr/
·         Open the solrconfig.xml file from (solr-5.4.1\server\solr\ sitecore_core_index \conf) for each core which wanted to sync the data with slave. Ex : ap_web_index, na_web_index and eu_web_index.

·         Add replication request handler configuration to solrconfig.xml for above indexes


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

    <lst name="master">

      <str name="replicateAfter">commit</str>

      <str name="replicateAfter">optimize</str>        

      <str name="backupAfter">commit</str>     

      <str name="confFiles">schema.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>


3.2  Slave Solr Configuration : Configuring the Replication RequestHandler on a Slave Server
·         For CD connection slave configuration require

-       Slave URL : http://localhost:8984/solr/
·         Open the solrconfig.xml file from (solr-5.4.1\server\solr\ sitecore_core_index \conf) for each core, which is synced by Master Ex : ap_web_index, na_web_index and eu_web_index.

·         In solrconfig.xml, add replication request handler configuration to solrconfig.xml for above indexes.

Note: Master url will be “Solr Master” url.


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

        <lst name="slave">

       <str name="masterUrl">http://localhost:8983/solr/sitecore_core_index/replication</str>

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

          </lst>

  </requestHandler>

3.3 Update the core properties:  
           Set the following properties in the solrcore.properties file

enable.master=true
enable.slave=false


3.4 Troubleshooting the replication: 
      A) Restart both master as well slave solr service
     B) Open both Solr UI & validate whether master and slave configured properly or not as below image




     C) Validate the replication
·         Open Slave Solr UI  : http://localhost:8984/solr
·         Select the core Ex : sitecore_core_index
·         Click on Replication and see the replication interval as below




Comments

Popular posts from this blog

Sitecore Publishing target and Solr Configuration

Creating a new publishing target is very helpful if your Sitecore environment is setup in multiple content delivery servers. We can publish data from Master database to one or more publishing target databases. Main thing to notice here is Master database contains all versions of any content or assets while publishing target database contains single latest version for each language.      This post aims to provide systematic instructions to set up publishing target. It comprises of a target database (where the content will be published) and publishing target definition item in master database that points to that target database.             Post creation of publishing target need to take care of Solr configuration. This post cove master slave Solr configuration and onPublishEndAsync strategy. We are using 1 Solr Master instance and 6 Slave instance (2-EU, 2-Ap, 2- NA).     1   So...

Setup Sitecore Habitat v9.0 project in simple way

In this article , I would describe how to setup the Sitecore habitat V9.0 project with Sitecore Experience Platform 9.0 rev in very simple way. I used below system configuration to setup this project: 1. Windows 10 (32/64-bit) 2. IIS 10.0 3. .NET Framework 4.6.2 4. Microsoft Visual Studio 2017 5. Microsoft SQL Server 2017 6. Solr 6.6.2 7. Microsoft PowerShell® version 5.0 8. Web Platform Installer 5.0. 9. Web Deploy 3.6 for Hosting Servers 10. Node-v8.9.4-x64 Follow below steps to setup the project. A).   Habitat require Sitecore instance. Setup the clean Sitecore 9.0 instance. Ex : http://demo.local.com , Directory location : C:\inetpub\wwwroot\demo.local.com   For more info visit -   https://dev.sitecore.net/ B). Download the Habitat V9.0 project from Github site :  https://github.com/Sitecore/Habitat/     Note  :  When you download the packages, it is possible that the .ZIP packages are marked as blocke...

Web Deploy setup and configuration with Sitecore

Web Deploy empowers Visual Studio and WebMatrix to help developers streamline the deployment of Web applications to Microsoft IIS Web servers or to Microsoft Azure Websites. In addition, integration with Web Platform Installer allows developers to simply and easily install community webapplications.   This post describe the installation of Web Deploy and Configuration with Sitecore instance.  This post will be very useful if you want to sync your Sitecore media items with all of the CD's environment (Distributed environment) . In one of my previous project, I was keeping all the media items in file system and synchronizing all the files from CM to Cd's server. This solution is tested with 1 CMS and 6 CD's server (2-EU, 2- NA, 2- AP) with more than 5 Lakh files.  1.       Software Pre-requisites           a.       OS – Window 7/ Windows Server 2008 R2 Enterprise       ...