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 five new folders under the <node1_root>\<solr install folder>\server\solr\configsets folder :

    • CECatalogItemsIndex

    • CEOrdersIndex

    • CECustomersIndex

    • CEPriceCardsIndex

    • CEPromotionsIndex

  2. In the configsets folder, locate and copy the default 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 the SolrSchemas folder of the SolrSchemas.Sitecore.Commerce.x.x.x zip file, included in the Sitecore XC release package.

    • Copy the SolrSchemas\CatalogItems\*.* files to the configsets\CECatalogItemsItems\conf folder.

    • Copy the SolrSchemas\Customers\*.* files to the configsets\CECustomersIndex\conf folder.

    • Copy the SolrSchemas\Orders\*.* files to the configsets\CEOrders\basic_configs\conf folder.

    • Copy the SolrSchemas\PriceCards\*.* files to the configsets\CEPriceCardsIndex\conf folder.

    • Copy the SolrSchemas\Promotions\*.* files to the configsets\CEPromotionsIndex\conf folder.

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

    solr zk upconfig -d CECatalogItemsIndex\conf -n CECatalogItemsIndexConfig -z <ZOOKEEPER_URL>
    solr zk upconfig -d CEOrdersIndex\conf -n CEOrderIndexConfig -z <ZOOKEEPER_URL>
    solr zk upconfig -d CECustomersIndex\conf -n CECustomerIndexConfig -z <ZOOKEEPER_URL>
    solr zk upconfig -d CEPriceCardsIndex\conf -n CEPriceCardsIndexConfig -z <ZOOKEEPER_URL>
    solr zk upconfig -d CEPromotionsIndex\conf -n CEPromotionsIndexConfig -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 CatalogItemsScope collection:

    • name: CatalogItemsScope

    • config set: CECatalogItemsIndexConfig

    • numShards: <number of shards>

    • replicationFactor: <replication factor>

  4. Repeat for the following other index:

    • OrdersScope index (where config set is CEOrdersIndexConfig)

    • CustomersScope index (where config set is CECustomersIndexConfig)

    • PriceCardsScope index (where config set is CEPriceCardsIndexConfig)

    • PromotionsScope index (where config set is CEPromotionsIndexConfig)

    Note

    The index names CatalogItemsScope, OrdersScope, CustomersScope, PromotionsScope and PriceCardsScope are default values. You can customize these names, but they must match the names specified in the PlugIn.Search.PolicySet-1.0.0.json.

  5. Repeat to create the following collection of indexes to be used as secondary indexes by the switch on rebuild feature:

    • CatalogItemsScope-Rebuild index (where config set is CECatalogItemsIndexConfig)

    • OrdersScope-Rebuild index (where config set is CEOrdersIndexConfig)

    • CustomersScope-Rebuild index (where config set is CECustomersIndexConfig)

    • PriceCardsScope-Rebuild index (where config set is CEPriceCardsIndexConfig)

    • PromotionsScope-Rebuild index (where config set is CEPromotionsIndexConfig)

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.

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.