Configure Redis Cluster for distributed caching

Abstract

How to change the configuration from stand-alone Redis to Redis Cluster for distributed caching.

You can change the configuration of an existing Sitecore XC deployment to use your Redis Cluster to scale distributed caching. The default Sitecore XC deployment uses stand-alone Redis.

To change Commerce Engine caching configuration to use Redis Cluster:

  • In the config.json file of the Commerce Engine instance running the Authoring service, for example inetpub\wwwroot\CommerceAuthoring_Sc\wwwroot\config.json, in the "Caching" section, under "Redis", and then under "Options", update the "Configurations" property with the appropriate connection string.

    Note

    The connection string does not specify a database. Redis Cluster only supports one database, and uses database 0 by default.

    For example:

    "Caching":  
           ...
               "Redis":  {
                          ...
                             "Options":  {
                                           "Configuration":  "<YOUR_REDIS_CLUSTER:PORT>",
                                           "instanceName:  "Redis"
    

To change CE Connect caching configuration to use Redis Cluster:

  • In the inetpub\wwwroot\<storefront>\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config file, in the Redis options configuration section, update the <configuration> settings with the appropriate connection string.

    Note

    You must remove the defaultDatabase=1 from the configuration. Redis Cluster only supports one database, and uses database 0 by default.

    For example:

    <redis type="Sitecore.Commerce.Engine.Connect.RedisCacheSettings, Sitecore.Commerce.Engine.Connect.Caching">
              ...
               <options type="Sitecore.Commerce.Engine.Connect.CommerceRedisCacheOptions, Sitecore.Commerce.Engine.Connect.Caching">
                <configuration>YOUR_REDIS_CLUSTER,allowAdmin=true,syncTimeout=3600000</configuration>
                <instanceName>Redis</instanceName>
              </options>
            </redis>