0

I'm using the SitecoreSwitchOnRebuild feature, which involves two Solr index aliases - the "main" alias for search/update operations and the "rebuild" alias for rebuilding the index. My index data seems to be corrupted, so I need to remove all existing index data from both the "main" and "rebuild" aliases in Solr before rebuilding the indexes. When I initiate a rebuild operation after removing the data from both aliases, will the rebuild process:

Repopulate the "rebuild" alias with the new index data from scratch? Also update the "main" alias with the new index data once the rebuild is complete?

Or do I need to manually switch the aliases after the rebuild to make the new index data available on the "main" alias? I'm running Sitecore v10.3.0 and Solr 8.11.2. Any guidance on the proper steps to completely refresh both aliases would be much appreciated. Please let me know if you'd like me to modify or expand the question further.

3 Answers 3

0

You're absolutely correct about the behavior of SitecoreSwitchOnRebuild with "main" and "rebuild" aliases. Here's a breakdown of what happens and the steps to completely refresh both aliases:

Rebuild Process:

Yes, the rebuild process will: Repopulate the "rebuild" alias with new index data from scratch. Automatically update the "main" alias with the new data once the rebuild is complete. Sitecore handles the alias switching behind the scenes. Steps to Refresh Both Aliases:

Remove Existing Data: Use the Solr administration interface or API to remove all documents from both "main" and "rebuild" aliases. Initiate Rebuild:

Trigger a Sitecore index rebuild using your preferred method (e.g., scheduling, manual execution).

0

You do not need to manually remove any data from either index.

When using the SwitchOnRebuildSolrSearchIndex you specify core and rebuildcore. To begin with the main core is populated with the index data from your site. If you look at [path-to-solr]/server/solr/[your-core]/core.properties, you will see name = [your-core-name].

When you trigger a rebuild, information from your site is indexed and stored in the rebuild core. This process runs in parrallel and during the rebuild requests are still sent to the main core. Once the rebuild is complete, the two cores are switched over and the rebuild core becomes the main core.

If you then look in [path-to-solr]/server/solr/[your-core]/core.properties, you will see name = [your-rebuild-core-name].

The above examples relate to running SOLR locally on the file system. However, I believe a similar approach is used when using SOLR Cloud.

1
  • Does it follow the same approach in SOLR cloud as well ? I am using SOLR cloud
    – Harish
    Commented May 2 at 11:34
0

When working on Solr Cloud, you need to specify SwitchOnRebuildSolrCloudSearchIndex inside the index type.

Inside the index configuration on SolrCloud, you will need to add main alias and rebuild alias. It uses active alias for search and update operations and rebuild alias for rebuild operations. Index configuration on SolrCloud contains details as below:

  <param desc="collection">$(id)</param>
  <param desc="rebuildcollection">$(id)_rebuild</param>
  <param desc="mainalias">$(id)MainAlias</param>
  <param desc="rebuildalias">$(id)RebuildAlias</param>

In the above configuration, details of the config parameters are as follows:

  1. "$(id)": This is the primary index collection named "sitecore_web_index"
  2. "$(id)_rebuild": This is the rebuild index collection named "sitecore_web_index_rebuild"
  3. "$(id)MainAlias": This is an alias name for the primary index operations named "sitecore_web_indexMainAlias" pointing to "sitecore_web_index".
  4. "$(id)RebuildAlias": This is an alias name for the rebuild index operations named "sitecore_web_indexRebuildAlias" pointing to "sitecore_web_index_rebuild".

Each time when a index is rebuild, it happens in the secondary(rebuild) core. The secondary core then becomes the primary one after the rebuild operation is completed.

You can enable SolrCloud configuration through the file.

App_Config\Include\Examples\Sitecore.ContentSearch.SolrCloud.SwitchOnRebuild.config.example

More details on the same can be found here:

https://doc.sitecore.com/xp/en/developers/90/platform-administration-and-architecture/switch-solr-indexes.html

https://www.searchstax.com/blog/sitecore-switchonrebuild-and-searchstax-solrcloud/

Hope this helps!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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