9

enter image description here

We are doing Solr Master slave configuration for one of the environments . Now issue here is

1) Is it possible for Sitecore CMS to update indexes on Solr Master and do Out of the box search in Sitecore CMS by pointing towards Load Balance URL, If Yes then how do we give such settings.

2) How can CD point towards Load Balance URL to get Search results.how do we give such settings

7
  1. The Solr Master instance should have all cores/sitecore indexes used by your Sitecore environment configured as it is the only instance that will be writing to the cores. If you are not using a specific feature in Sitecore that has indexes, such as FXM, you should be fine not setting up the Solr core for it as long as the feature's configuration files are disabled.
  2. For replication to the Solr Slave instances, you'll want to setup replication for any core that is needed for the Sitecore server/role that is pointing to the solr slave instance. You'll want to go through the Configuration enable/disable excel spreadsheet to get the full list of indexes for your specific version. If only your Content Delivery boxes are pointing to the Solr Slave instance, then only indexes that are required for the Content Delivery instance need to be replicated over.

Note that you will want to update the index strategies for each index on the Content Delivery instance to be manual. The indexes won't be able to rebuild as the Solr Slave instance is read-only. Should prevent any unnecessary processing and error log entries as it would fail to rebuild.

  • 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 all 15 cores a mentioned in soen.ghost.io/setting-up-solr-for-sitecore-8-x for both Master and Slave. So: 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 or or cores required by web 3) Do I need to set indexing strategy in Web to Manual for all 15 cores – Nicks Feb 7 '17 at 3:44
  • I've updated my answer to address questions in the comment. Please let me know if further clarification is needed. – Patrick Barron Feb 7 '17 at 14:48
4

Instance Details

  • Sitecore 8.2 u4
  • Solr 5.1

The following is a brief explaination of how we recently implemented a master/slave configuration by using SOLR replication.

I'll take the diagram from the article linked below since it depicts what we did.

SOLR Diagram

  • SOLR-master is connected to the CM instance. When the CM rebuilds the sitecore_web_index the SOLR-master instance is doing all of the processing.

  • SOLR-slave is connected to the CD instance. You can either have each instance of the CD talk directly to a slave instance or you can connect them to a load balancer (F5/Netscaler/etc.). The SOLR-slave instances poll at some interval (perhaps 60 seconds); If the SOLR-master has completed a commit/startup then the SOLR-slave instances will replicate the files.

Config Files

<!-- solrconfig.xml for master instance -->
<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>
<!-- solrconfig.xml in slave instances -->
<requestHandler name="/replication" class="solr.ReplicationHandler" > 
     <lst name="slave">
       <str name="enable">true</str>
       <str name="masterUrl">https://load-balanced-url/solr/sitecore_web_index</str>
       <str name="pollInterval">00:01:00</str>
       <str name="compression">internal</str>
       <str name="httpConnTimeout">5000</str>
       <str name="httpReadTimeout">10000</str>
     </lst>
</requestHandler>

References

  • 1
    This is the correct configuration - we have used this many times. In general we disable compression (due to the CPU load it generates) and have the replication trigger in a custom Sitecore publication:end event handler rather than on commit because Sitecore issues commits in the middle of rebuilding, after the delete stage, which triggers the empty index to be replicated out - which you obviously don't want. – Richard Hauer Dec 20 '17 at 12:12
2

I'm not sure what version of Sitecore you are using or if this will work for you or not but an alternative is to using Solr Slave/Master is to use Solr Cloud.

In this scenario you have 3 Solr servers all linked together in a Cloud with Zookeeper maintaining the connections between them.

I've included quite a lot of information on how we set this up in this SSE post:

Sitecore Content deliveries and Solr with High availability

I think as Marek says above though it would be a good to understand more why your have the setup you've outlined as it seems a bit different to normal.

1

From what I know it is not possible to configure Sitecore CM server to send index updates to one Solr server and queries to another.

What you can do is to configure CM server to use Load Balancer as well. And then configure Load Balancer to pass all queries to Solr Slaves and all the other types of requests to Solr Master server. See here:

enter image description here

But the real question is, why do you want Author Content Search to hit the Solr Slaves servers? For CM server it should be ok to use Solr Master for Author Content Search queries.

1

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:

enter image description here

Multiple slaves server architecture:

enter image description here

Configuring the Replication RequestHandler on a Master Server

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.

  1. Open solrconfig.xml under Solr sitecore_core_index core folder
  2. Uncomment master node under
  3. Set the following parameters on initialization of the handler (replicateAfter, backupAfter, confFiles, commitReserveDuration)
  4. 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

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.

  1. Open solrconfig.xml under Solr sitecore_core_index core folder
  2. Uncomment slave node under
  3. Set the following parameters on initialization of the handler (masterUrl, pollInterval, compression, httpConnTimeout, httpReadTimeout, httpBasicAuthUser, httpBasicAuthPassword)
  4. Repeat these steps for other indexes

For more information about how the purpose of each parameter and parameters values please read page 483 on https://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-4.10.pdf

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.

Configuring Sitecore CM server

Sitecore CM server will be responsible for updating/rebuilding indexes. Please configure your CM instance as illustrated below:

  1. Enable all Sitecore indexes configuration files - Don't follow the Sitecore search indexes required in a scalable environment content management section
  2. Set your Solr master server URL

enter image description here

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:

  1. Enable CD Sitecore indexes configuration files only - Do follow the Sitecore search indexes required in a scalable environment content delivery section
  2. Set your Solr slave server URL

enter image description here

1

The answer from @Michael West is the most complete. One piece that is missing, however, is how to handle a secured Solr connection, i.e. any 9.x connections that use https.

In my case, I was using self-signed certs that I generate. In order to get replication working properly over https, the same certificate must be used for all Solr instances. In my case, it was a master and a single slave, but the same holds true for multiple slaves.

When generating the Solr certificate, you must ensure that the certificate covers all Solr instances. You can achieve this with a wildcard certificate or a SAN certificate (which is what I went with).

Powershell to Generate Cert

$cert = New-SelfSignedCertificate -DnsName "DNS1.com","DNS2.com" -CertStoreLocation "cert:\LocalMachine" -NotAfter (Get-Date).AddYears(10) 
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store "Root","LocalMachine"
$store.Open("ReadWrite")
$store.Add($cert)
$store.Close()
$cert | Remove-Item

Pay special attention to how multiple DNS names are formatted in the cmdlet.

This will likely generate the certificate in the wrong location (I tried multiple times to add it to the Trusted Root Authority directly, but it wouldn't let me). So export it:

Powershell to Export Cert

$cert = Get-ChildItem Cert:\LocalMachine\Root -Recurse | where Subject -match "DNS1.com"
$certStore = "c:\Solr\solr-6.6.2\server\etc\solr-ssl.keystore.pfx"
$certPwd = ConvertTo-SecureString -String "MYPASSWORD" -Force -AsPlainText
$cert | Export-PfxCertificate -FilePath $certStore -Password $certpwd | Out-Null

Note that the Subject is the first DNS name specified. Also, in my case, I exported it directly to the Solr file system store.

Clean Up

Remove any Solr certificates in Personal Store:

  1. Run
  2. mmc.exe
  3. Add Snap-In: certificates > Local Computer
  4. Delete any certs in Personal Store that pertain to Solr

Usage

Follow any Solr SSL guides (like Jeremy Davis' Low Effort Guide). Be sure to use this same certificate on all Solr instances that are installed. The thumbprint must match on all servers.

Why is this required?

Solr has it's own "store". It's not much like a Windows Store or Java Store though... it allows only for a single certificate. This certificate is used on the instance it is installed on as well as any instances it tries to contact- thus the need for all DNS names to be present.

Reference:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.