1

i am unable to add redis endpoint in magento 2.1 below is my code that i added in "etc/env.php"

Please let me know what i am missing

 'cache' =>
    array(
       'frontend' =>
       array(
          'default' =>
          array(
             'backend' => 'Cm_Cache_Backend_Redis',
             'backend_options' =>
             array(
                'server' => 'xyz-redis-latest.opb3io.0001.aps1.cache.amazonaws.com',
                'database' => '0',
                'port' => '6379'
                ),
        ),
        'page_cache' =>
        array(
          'backend' => 'Cm_Cache_Backend_Redis',
          'backend_options' =>
           array(
             'server' => 'xyz-redis-latest.opb3io.0001.aps1.cache.amazonaws.com',
             'port' => '6379',
             'database' => '1',
             'compress_data' => '0'
           )
        )
      )
    ),
0

1 Answer 1

1

For Backend cache on Redis

use below sample command:

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

For Page Cache on Redis

use below sample command:

php bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=xxxxxxxxxxx --page-cache-redis-db=1

After above commands env.php will be updated automatically.

Both cache could be save on same redis server but it will use different databases 0 and 1

Note: For local redis cache, use 127.0.0.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.