cancel
Showing results for 
Search instead for 
Did you mean: 

Redis and Magento 2 not working

SOLVED

Redis and Magento 2 not working

Hello

I'm having an issue get Magento 2 and Redis working together. When I try to configure Magento with Redis I get this page is not responding. The issue seems to be with the env.php when making an edit I get the issue and able to copy the backup file back and the site works. 

 

Can someone tell me what I am doing wrong, I tried everything.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Redis and Magento 2 not working

Can you confirm what made it work?

View solution in original post

7 REPLIES 7

Re: Redis and Magento 2 not working

Hello,

 

 

Make sure you add redis on server

 

you need to add below thing to env.php

 

'MAGE_MODE' => 'production',
  'session' => 
  array (
    'save' => 'redis',
    'redis' => 
    array (
      'host' => '127.0.0.1',
      'port' => '6379', // port number
      'password' => '',
      'timeout' => '2.5',
      'persistent_identifier' => '',
      'database' => '12',
      'compression_threshold' => '2048',
      'compression_library' => 'gzip',
      'log_level' => '3',
      'max_concurrency' => '6',
      'break_after_frontend' => '5',
      'break_after_adminhtml' => '30',
      'first_lifetime' => '600',
      'bot_first_lifetime' => '60',
      'bot_lifetime' => '7200',
      'disable_locking' => '0',
      'min_lifetime' => '60',
      'max_lifetime' => '2592000',
    ),
  ),
  'cache_types' => 

Please add above code into session array.

 

If work then gives kudos or mark as solution.

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Redis and Magento 2 not working

No that didn't work, still getting this page isn't working.

Re: Redis and Magento 2 not working

Can you show me what the whole file should look like env.php file

Re: Redis and Magento 2 not working

Hello @bigd46

<?php
return array (
  'backend' => 
  array (
    'frontName' => 'admin',
  ),
  'db' => 
  array (
    'connection' => 
    array (
      'indexer' => 
      array (
        'host' => 'localhost',
        'dbname' => 'db-name',
        'username' => 'db-username',
        'password' => 'password',
        'active' => '1',
        'persistent' => NULL,
        'model' => 'mysql4',
        'engine' => 'innodb',
        'initStatements' => 'SET NAMES utf8;',
      ),
      'default' => 
      array (
        'host' => 'localhost',
        'dbname' => 'db-name',
        'username' => 'db-password',
        'password' => 'tAH2rpjxwj4cbT',
        'active' => '1',
        'model' => 'mysql4',
        'engine' => 'innodb',
        'initStatements' => 'SET NAMES utf8;',
      ),
    ),
    'table_prefix' => '',
  ),
  'crypt' => 
  array (
    'key' => '0805f34deb9fbce406d4f3ac6cf8e15211111',
  ),
  'resource' => 
  array (
    'default_setup' => 
    array (
      'connection' => 'default',
    ),
  ),
  'x-frame-options' => 'SAMEORIGIN',
  'MAGE_MODE' => 'production',
  'session' => 
  array (
    'save' => 'redis',
    'redis' => 
    array (
      'host' => '127.0.0.1',
      'port' => '6379',
      'password' => '',
      'timeout' => '2.5',
      'persistent_identifier' => '',
      'database' => '2',
      'compression_threshold' => '2048',
      'compression_library' => 'gzip',
      'log_level' => '3',
      'max_concurrency' => '6',
      'break_after_frontend' => '5',
      'break_after_adminhtml' => '30',
      'first_lifetime' => '600',
      'bot_first_lifetime' => '60',
      'bot_lifetime' => '7200',
      'disable_locking' => '0',
      'min_lifetime' => '60',
      'max_lifetime' => '2592000',
    ),
  ),
  'cache_types' => 
  array (
    'config' => 1,
    'layout' => 1,
    'block_html' => 1,
    'collections' => 1,
    'reflection' => 1,
    'db_ddl' => 1,
    'eav' => 1,
    'customer_notification' => 1,
    'config_integration' => 1,
    'config_integration_api' => 1,
    'target_rule' => 1,
    'full_page' => 1,
    'translate' => 1,
    'config_webservice' => 1,
    'compiled_config' => 1,
    'amasty_shopby' => 1,
  ),
  'install' => 
  array (
    'date' => 'Wed, 14 Mar 2018 11:47:14 +0000',
  ),
  'system' => 
  array (
    'default' => 
    array (
      'dev' => 
      array (
        'debug' => 
        array (
          'debug_logging' => '0',
        ),
      ),
    ),
  ),
  'cache' => 
  array (
    'frontend' => 
    array (
      'default' => 
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' => 
        array (
          'server' => '127.0.0.1',
          'database' => '0',
          'port' => '6379',
        ),
      ),
      'page_cache' => 
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' => 
        array (
          'server' => '127.0.0.1',
          'database' => '1',
          'port' => '6379',
          'compress_data' => '0',
        ),
      ),
    ),
  ),
);

Hope it will help you.

 

If work then gives kudos or mark as solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Redis and Magento 2 not working

Just to confirm if you have Redis installed properly and listening to port 6379 in the same server? 

Re: Redis and Magento 2 not working

Thanks, works

 

Re: Redis and Magento 2 not working

Can you confirm what made it work?