Solr is a great search engine that Sitecore recommends. Solr is highly reliable and scalable, providing distributed indexing, replication and load-balanced querying, centralized configuration and more.
In this article, I will explain how to setup Solr master/slave index replication and configure Sitecore in order to use it.
Note: I assume that Solr is in place and Sitecore basic configuration is implemented as explain in Sitecore documentation (https://doc.sitecore.net/sitecore_experience_platform/81/setting_up_and_maintaining/search_and_indexing/walkthrough_setting_up_solr)
First of all, let me list down the list of software versions that I used in this article
Configuring the Replication RequestHandler on a Master Server
In this article, I will explain how to setup Solr master/slave index replication and configure Sitecore in order to use it.
Note: I assume that Solr is in place and Sitecore basic configuration is implemented as explain in Sitecore documentation (https://doc.sitecore.net/sitecore_experience_platform/81/setting_up_and_maintaining/search_and_indexing/walkthrough_setting_up_solr)
First of all, let me list down the list of software versions that I used in this article
- Sitecore Experience Platform 8.1 rev. 160519 (8.1 Update-3)
- Solr 4.10.4 - recommended Solr version for Sitecore 8.1
What is Solr Index Replication?
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.
Sitecore & Solr Master/Slave server architecture
Below you can find two suggested architecture for Sitecore based on Solr master/slave index replication.
Single slave server architecture:
Index replication will be configured in Solr core level by enabling master replication request handler in Solr Master Server. Let me share how to configure it on sitecore_core_index.
- Open solrconfig.xml under Solr sitecore_core_index core folder
- Uncomment master node under <requestHandler name="/replication" class="solr.ReplicationHandler" >
- Set the following parameters on initialization of the handler
- replicateAfter
- backupAfter
- confFiles
- commitReserveDuration
- Repeat these steps for other indexes
For more information about how the purpose of each parameter and parameters values please read page 481 on https://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-4.10.pdf
Example:
Configuring the Replication RequestHandler on a Slave Server
Index replication will be configured in Solr core level by enabling slave replication request handler in Solr Slave server. Let me share how to configure it on sitecore_core_index.
- Open solrconfig.xml under Solr sitecore_core_index core folder
- Uncomment slave node under <requestHandler name="/replication" class="solr.ReplicationHandler" >
- Set the following parameters on initialization of the handler
- masterUrl
- pollInterval
- compression
- httpConnTimeout
- httpReadTimeout
- httpBasicAuthUser
- httpBasicAuthPassword
- Repeat these steps for other indexes
Note: Solr slave servers are read only and can't update indexes that is why we will explain later few changes on both Sitecore CM & CD instances configurations.
Example:
Configuring Sitecore CM server
Sitecore CM server will be responsible for updating/rebuilding indexes. Please configure your CM instance as illustrated below:
- Enable all Sitecore indexes configuration files - Don't follow the Sitecore search indexes required in a scalable environment content management section
- Set your Solr master server URL
Configuring Sitecore CD server
Sitecore CD server will query from Slave servers only, so you will need to patch the Sitecore default configuration by changing indexes strategy to manual. Please configure your CD instance as illustrated below:
- Enable CD Sitecore indexes configuration files only - Do follow the Sitecore search indexes required in a scalable environment content delivery section
- Set your Solr slave server URL
Downloads
Sitecore CD server configuration: zzz.Solr.CD.config
Nice article
ReplyDeleteThank you Nalan. Hope it is helpful.
DeleteHi, does master also respond to queries?
ReplyDeleteExemplo for high avaiability, just 1 master and 1 slave its ok?
Or do i must have 2 slaves?
Or 2 masters and 2 slaves?
In case I have 1 master and 1 slave, if slave goes down master also respond to queries?