Thursday, July 28, 2016

Solr Cloud Patch for Sitecore 8.1

Sitecore has some issues working with Solr Cloud out of the box. There is an unofficial patch for it here. I was able to get it to work with my setup (8.1 rev 160302, Solr Cloud 5.3.1, Castle.Windsor 3.3), with the following modifications.


  1. No changes to the Global.asax file. Use the default one.
  2. Disable the file Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.dll in the \bin folder.
  3. Add the file Sitecore.Support.405677.Windsor.dll to the \bin folder.
  4. Add the file Sitecore.Support.ContentSearch.Solr.WindsorInitializer.405677.config to the \Include\Sitecore.Support.405677 folder.
  5. Add the file Sitecore.Support.449298.dll to the \bin folder.
  6. Add the file Sitecore.Support.449298.config to the \Include\Sitecore.Support.449298 folder.
  7. Add the file Sitecore.Support.449298.SwitchOnRebuild.IndexConfig.example to the \Include\Sitecore.Support.449298 folder.
  8. Enable and configure the file Sitecore.Support.449298.SwitchOnRebuild.IndexConfig.example. This includes setting the collection names for the master, web and core indexes, as well as the ServiceBaseAddress of your Solr instance.
  9. Add the file SolrCloud.config to your \zzzMustBeLast folder (or whatever your equivalent "run these configs last" folder is).


The SolrCloud.config file switches ALL the Sitecore indexes over to using the patched Solr Cloud indexing. Feel free to edit this as needed, or to include your own custom indexes in here.

Note: Make sure that your Solr instance has all the cores that you've declared in these indexes. IE: sitecore_master_index, sitecore_master_index_secondary, etc.

WARNING: When using this patch, you will notice some ERRORS appearing in your log that coincide with whenever you open the Index Manager window. I have confirmed with Sitecore Support that this is just noise and can be ignored, it doesn't affect the functionality of the patch.

"You can safely ignore these messages. They indeed happen to Indexing manager and bound to the fact that we can't get index summary in the current realization of this patch. But this shouldn't affect indexing and everything should work fine."

Here are copies of all the files I used.
Sitecore.Support.405677.zip
Sitecore.Support.449298-8.1.zip
SolrCloud.config

5 comments:

  1. Hey quick question .. for getting SolrCloud switch on rebuild working with Sitecore 8, did you implement the patch in both CM and CDs or CM only? We are facing an odd issue where CM points to the correct indexes but the CD points to the old indexes after a rebuild. Since CDs only care about the primary indexes, can CDs do without this patch?

    ReplyDelete
    Replies
    1. I implemented it in both CM and CD. I don't believe you can just assume which core is the one that Sitecore considers "primary" at any given time, as I think that changes each time you rebuild the indexes. From the docs...

      "After you have changed the configuration file, your website uses indexes from the primary core. Each time you initiate a full index rebuild, Sitecore does this in the secondary core. The secondary core then becomes the primary one after the rebuild."

      https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/search_and_indexing/indexing/switch_solr_indexes

      Delete
  2. Sitecore.Support.449298-8.1.zip contains a VS project you would use to create the needed Sitecore.Support.449298 DLL. However, when you unzip and launch the project you may get errors associated with accessing certian nuget packages which the VS project depends on to provide certain DLLs. After closer examination, I realized that the DLLs are the same ones which exist in your Sitecore /Website/bin folder.

    If you cannot access these nuget packages like I couldn't, replace the DLLs required with copies taken from your Sitecore instance's bin folder. For instance, create a Library folder in the VS project and placed a copy of the DLLs in there. Update the References section to use that set.

    The DLLs I am referencing are: Microsoft.Practices.ServiceLocation, Newtonsoft.Json, Sitecore.ContentSearch, Sitecore.ContentSearch.Linq, Sitecore.ContentSearch.SolrProvider, Sitecore.Kernel and SolrNet.

    ReplyDelete
  3. Is it fixed in newer Sitecore versions?

    ReplyDelete
    Replies
    1. It should be fixed as of Sitecore 8.2. Not 100% sure the exact update it was fixed, but I've used 8.2 update 3 SolrCloud without needing a patch.

      Delete