Set up Redis service

Redis is an optional, backend cache solution that replaces the Zend Framework Zend_Cache_Backend_File, which is used in Magento 2 by default.

We support Redis versions 2.8, 3.0, and 5.0. Redis 3.0 supports up to 64 different databases per instance of the service, while 2.8 allows for only a single database. See Configure Redis.

You can use the following instructions for service setup on Magento Commerce Cloud Pro Integration environments and Starter environments, including master branch. You must submit a support ticket to configure the service on Pro Production and Staging environments. See Services.

Add Redis in configuration files

To enable Redis, add your installed version and allocated disk space in MB to .magento/services.yaml file:

1
2
myredis:
    type: redis:3.0

To provide your own Redis configuration, add a core_config key in your .magento/services.yaml file:

1
2
cache:
    type: redis:3.0

To configure relationships for an environment variable in your .magento.app.yaml file:

1
2
3
4
5
6
runtime:
    extensions:
        - redis

relationships:
    redis: "myredis:redis"

Merge and deploy the code to set the configurations for Redis. For information on how these changes affect your environments, see services.yaml.

Verify environment-related relationships

We use the Magento Commerce Cloud environment variable $MAGENTO_CLOUD_RELATIONSHIPS, a JSON object, to retrieve environment-related relationships.

To verify information used for configurations and settings:

  1. Use SSH to log in to the remote environment.

  2. Create pretty-print of all relationships for services and configuration data for that environment.

    1
    
    php -r 'print_r(json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"])));'
    

Using the Redis CLI

Assuming your Redis relationship is named redis, you can access it using the redis-cli tool.

  1. Use SSH to connect to the Integration environment with RabbitMQ installed and configured.
  2. Open an SSH tunnel to a host.

    1
    
    redis-cli -h redis.internal