Platform Administration and Architecture

Walkthrough: Setting up SolrCloud

Abstract

Learn how to set up SolrCloud on Sitecore

Sitecore supports SolrCloud – the Solr scaled environment. This walkthrough describes how to configure Sitecore to use SolrCloud as a search provider. It does not demonstrate how to install SolrCloud itself.

Note

This topic is valid for Sitecore 9, Update 2, and later.

This walkthrough describes how to:

  • Create a SolrCloud farm

  • Upload the configuration to Zookeeper

  • Create a collection

  • Configure Sitecore to use SolrCloud

  • Populate the Solr schema

  • Enable support for SSL

To create a SolrCloud farm:

  • Follow the instructions on the Solr website to install Solr and create a scaled environment, using two or more Solr nodes, with one or more external Zookeeper ensembles.

Note

This walkthrough assumes a simple cluster with two Solr nodes and one Zookeeper ensemble.

Follow these steps to upload the Solr configuration to Zookeeper:

  1. In one of the Solr nodes you have set up, locate the configset folder under the <node1_root>\solr\serverfolder and copy the basic_configs folder to a new sitecore_configs folder.

  2. In the sitecore_configs/solrconfig.xml file , set the autoCreateFields setting to false (update.autoCreateFields:false).

  3. In this new folder, open the managed-schema file in the conf folder and do the following:

    • Set the value in <uniqueKey>id</uniqueKey> to _uniqueid.

    • In the fields section, add the following field configuration for _uniqueid:

      <field name="_uniqueid" type="string" indexed="true" required="true" stored="true"/>

  4. In the <solr_root> folder, run the following command:

    solr zk upconfig -d sitecore_configs -n sitecore -z <ZOOKEEPER_URL>

When you have uploaded the Solr configuration to Zookeeper, you can create collections.

To create a collection:

  1. Navigate to the Collections page in the Solr admin UI, using one of the nodes you created.

  2. Click Add Collection.

  3. In the config set field, click the sitecore collection.

  4. Specify the following fields as shown:

    Walkthrough_Setting_up_SolrCloud-Picture_2-rId12-554750973.png
  5. Repeat for all Sitecore indexes.

Sitecore must connect to a load-balancer, and the load-balancer must handle failover for the Solr nodes.

Follow these steps to configure Sitecore to use SolrCloud as search provider:

  1. Open the App_Config\ConnectionStrings.config file

  2. Specify the value of the solr.search key and add the token solrCloud=true:

    <add name="solr.search" connectionString="http://localhost:8983/solr;solrCloud=true" />

If you want to configure basic authentication, you must add credentials to the connection string as the like this:

<add name="solr.search" connectionString="http://username:password@localhost:8983/solr;solrCloud=true" />

Note

The hostname of the load balancer is localhost in the above examples. Replace as needed.

To populate the Solr schema:

  1. Open the Sitecore Control Panel.

  2. Click Populate Solr Managed Schema.

  3. Select all indexes and click Populate.

If you have enabled SSL for Solr, you must:

  • In the ConnectionStrings.config file, ensure that the contentSearch.solr connection string is an https URL.