Walkthrough: Setting up SolrCloud on Sitecore XC

Abstract

How to set up Sitecore XC environments for SolrCloud and configure the Commerce Engine to support it.

Commerce Search supports SolrCloud (the Solr scaled environment). This walkthrough describes how to configure Sitecore XC environments and use SolrCloud as a search provider. It does not describe how to install SolrCloud itself.

Important

As with Sitecore XP SolrCloud configuration, Sitecore XC SolrCloud configuration requires a load balancer.

SolrCloud affects the following Commerce environments:

  • Authoring

  • Minions

  • DevOps

Note

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

This walkthrough describes how to:

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 services.

Alternatively, if you have already created a scaled Solr environment for your Sitecore XP deployment (described here), you can use the same SolrCloud instance for the Commerce Engine. 

Note

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

It is recommended that you configure your load balancer to check whether each Solr node is available and returning status code OK. Refer to the Solr ping documentation for more information.

If you have two Solr nodes behind a load balancer, you need to check every Commerce Search Index for each node.  By default, each Solr node should have three indexes: one index each for CatalogItems, Orders, and Customers.

Follow these steps to upload the Solr configuration to Zookeeper:

  1. In one of the Solr nodes you have set up, create three new folders under the folder <node1_root>\solr\serverfolder\configsets folder:

    • CECatalogItemIndex

    • CEOrderIndex

    • CECustomerIndex

  2. In the configsets folder, locate and copy the basic_configs folder into each new sub-folder you created above. 

  3. Copy the Sitecore XC Solr schema files for each Sitecore XC index to the appropriate sub-folder. 

    Sitecore XC Solr schemas are available in theSolrSchemas folder of the SIF.Sitecore.Commerce.x.x.x zip file, included in the Sitecore XC release package.

    1. Copy the SolrSchemas\CatalogItems\managed-schema file to the configsets\CatalogItems\basic_configs\conf folder.

    2. Copy the SolrSchemas\Customers\managed-schema file to the configsets\Customers\basic_configs\conf folder.

    3. Copy the SolrSchemas\Orders\managed-schema file to the configsets\Orders\basic_configs\conf folder.

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

    solr zk upconfig -d CECatalogItemIndex\conf -n CECatalogItemIndexConfig -z <ZOOKEEPER_URL>
    solr zk upconfig -d CEOrderIndex\conf -n CEOrderIndexConfig -z <ZOOKEEPER_URL>
    solr zk upconfig -d CECustomerIndex\conf -n CECustomerIndexConfig -z <ZOOKEEPER_URL>
    

When you have uploaded the Solr configurations to Zookeeper, you can create each Sitecore XC collection. 

Follow these steps to create your Sitecore XC collections:

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

  2. Click Add Collection.

  3. Specify values for the following fields and click Add Collection to create the CatalogItemScope collection:

    • name: CatalogItemsScope

    • config set: CECatalogItemIndexConfig

    • numShards: <number of shards>

    • replicationFactor: <replication Factor>

  4. Repeat for the OrdersScope index (where config set is CEOrderindexConfig) and the CustomersScope index (where config set is CECustomerIndexConfig).

    Note

    The CatalogItemsScope, OrdersScope, and CustomersScope names are all default values. You can customize these names, but they must match the names specified in the Search Plugin policy.

Both Commerce Engine and Sitecore require a connection to a load balancer. The load balancer must handle the failover for the Solr nodes.

Follow these steps for each environment to configure Commerce Engine to use SolrCloud as a search provider:

  1. Open the PlugIn.Search.Solr.PolicySet-1.0.0.json file.

  2. Set the following parameters:

    • "IsSolrCloud" : "true"

    • "SolrUrl" : "<loadbalancerUrl>/solr"

  3. Bootstrap the Commerce Engine, as described in the Bootstrap the Commerce Engine topic.

If you have enabled SSL for Solr, you must:

  • Ensure that the solr.search connection string in the ConnectionStrings.config file is an https URL.