In the Sitecore managed cloud environment, SwitchOnRebuild Solr Index feature is not enabled in our instance. This article will help you to setup the feature. These steps can be followed for any solr cloud setup whether it is in SearchStax or On-Prem solr cloud solution.
- Get Solr Admin Username and Password
Make sure you have Solr Admin username and password. You can refer the original environment provision ticket from Sitecore.
- Get the config sets name from the existing Solr Collection
Login to Solr admin, go to master, web and core collections. You will get the config sets names.
In my case, master and web collection have sitecoreconfigset-master-web and core collection has sitecoreconfigset. - Create Solr collections and aliases
We need to create rebuild collections for master, web and core collections. Along with that, we need to create Aliases.Collection Name Rebuild Collection Name Main Alias Name Rebuild Alias Name sitecore_web_index sitecore_web_index_rebuild sitecore_web_indexMainAlias
points to sitecore_web_indexsitecore_web_index_rebuild
points to sitecore_web_index_rebuildsitecore_master_index sitecore_master_index_rebuild sitecore_master_indexMainAlias
points to sitecore_master_indexsitecore_master_index_rebuild
points to sitecore_master_index_rebuildsitecore_core_index sitecore_core_index_rebuild sitecore_core_indexMainAlias
points to sitecore_core_indexsitecore_core_index_rebuild
points to sitecore_core_index_rebuild
Below CURL requests will help you to create the collections and as well as aliases. You can execute these requests in the same browser where Solr Admin is logged in.# Create Collections https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATE&name=sitecore_web_index_rebuild&numShards=1&replicationFactor=3&maxShardsPerNode=1&collection.configName=sitecoreconfigset-master-web https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATE&name=sitecore_master_index_rebuild&numShards=1&replicationFactor=3&maxShardsPerNode=1&collection.configName=sitecoreconfigset-master-web https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATE&name=sitecore_core_index_rebuild&numShards=1&replicationFactor=3&maxShardsPerNode=1&collection.configName=sitecoreconfigset # Create Aliases https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATEALIAS&name=sitecore_web_indexMainAlias&collections=sitecore_web_index https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATEALIAS&name=sitecore_web_indexRebuildAlias&collections=sitecore_web_index_rebuild https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATEALIAS&name=sitecore_master_indexMainAlias&collections=sitecore_master_index https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATEALIAS&name=sitecore_master_indexRebuildAlias&collections=sitecore_master_index_rebuild https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATEALIAS&name=sitecore_core_indexMainAlias&collections=sitecore_core_index https://abc-xyzsearchstax.com/solr/admin/collections?action=CREATEALIAS&name=sitecore_core_indexRebuildAlias&collections=sitecore_core_index_rebuild
- Add SolrCloud in Connection String and Enable SwitchOnRebuild config in Sitecore
Step 1: Update the solr.search connection string to have ;solrCloud=true at the end. In our managed cloud instance, this was enabled already.
Step 2: Copy and rename the example Sitecore patch file (\App_Config\Include\Examples\Sitecore.ContentSearch.SolrCloud.SwitchOnRebuild.config.example) in Include folder.
The feature is enabled now. You can now rebuild the indexes and the subsequent index rebuild will not bring down the Site Search feature from your site. - Add MainAlias as the Collection name in CD
Many folks may forget this. In order for the CD environment to use the mainAlias as the primary collection, we need to patch the core param in Sitecore.ContentSearch.Solr.Index.Master.config to use mainAlias. <param desc="core">$(id)MainAlias</param>.
No comments:
Post a Comment