Stratus Guides - Redis Cache Configuration

All Webscale STRATUS Magento stores are required to have cache enabled in Production environments and to use Redis for storage cache and Varnish cache for Magento 2 Full Page Cache.

Webscale STRATUS does not allow cache to be stored in files or the database.

Redis caches are controlled and configured in the Redis section of the Webscale STRATUS Control panel.

Accessing Redis Cache via SSH

The Webscale STRATUS Redis services are accessible directly via SSH:

redis-cli -h redis -p 6379
redis-cli -h redis-config-cache -p 6381
redis-cli -h redis-session -p 6380

In addition to the Webscale STRATUS Control panel, Redis commands can be used to control the Redis cache on the STRATUS install. With exception to Varnish for the Magento 2 FPC, Redis is recommended for all caches on Webscale STRATUS.

Configuring Redis Caches

Redis Full Page Cache and Redis Sessions must be enabled in the Webscale STRATUS Control panel.

Magento 2

Use the following commands via CLI:

  • Redis Cache

    php bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redis-config-cache --cache-backend-redis-db=0 --cache-backend-redis-port=6381

  • Redis FPC

    php bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=redis --page-cache-redis-db=0 --page-cache-redis-port=6379

  • Redis Session

    php bin/magento setup:config:set --session-save=redis --session-save-redis-host=redis-session --session-save-redis-log-level=3 --session-save-redis-db=0 --session-save-redis-port=6380 --session-save-redis-disable-locking=1

Magento 1

Add the following to the Magento local.xml configuration, then flush the cache to apply the change.

Check the developer document for any 3rd party FPC module. Most support Redis. The Redis Config Cache container can be enabled in Redis > Config Cache in the Webscale STRATUS Control panel.


Add for Full Page Cache (Magento 1.x Enterprise Edition only)

    <server>redis-config-cache</server> <!-- or absolute path to unix socket -->
    <persistent></persistent> <!-- Specify unique string to enable persistent connections. E.g.: sess-db0; bugs with phpredis and php-fpm are known: -->
    <database>0</database> <!-- Redis database number; protection against accidental data loss is improved by not sharing databases -->
    <password></password> <!-- Specify if your Redis server requires authentication -->
    <force_standalone>0</force_standalone>  <!-- 0 for phpredis, 1 for standalone PHP -->
    <connect_retries>1</connect_retries>    <!-- Reduces errors due to random connection failures -->
    <lifetimelimit>57600</lifetimelimit>    <!-- 16 hours of lifetime for cache record -->
    <compress_data>0</compress_data>        <!-- DISABLE compression for EE FPC since it already uses compression -->
    <auto_expire_lifetime>604800</auto_expire_lifetime> <!-- Force an expiry (Enterprise_PageCache will not set one) -->
    <auto_expire_refresh_on_load></auto_expire_refresh_on_load> <!-- Refresh keys when loaded (Keeps cache primed frequently requested resources) -->

Enabling Caches

The caches can be enabled using commands via SSH:

  • Magento 1 — n98-magerun cache:enable
  • Magento 2 — n98-magerun2 cache:enable

Flushing Caches

Redis caches may need to be cleared during development or to troubleshoot a site issue. Redis cache can be flushed via SSH:

redis-cli -h redis -p 6379 FLUSHALL
redis-cli -h redis-config-cache -p 6381 FLUSHALL
redis-cli -h redis-session -p 6380 FLUSHALL

Note: Redis cache sessions will NOT be cleared by the command /user/share/stratus/cli-cache.all.clear nor will they clear during a redeployment.

Last modified January 1, 0001