Redis is installed in docker and after deployment I see a new error. I connected to the Redis container and Redis status is OK. Full error:
<b>Fatal error</b>
: Uncaught CredisException: Connection to Redis redis:6379 failed after 2 failures.Last Error : (1) Connection refused in /var/www/html/vendor/colinmollenhour/credis/Client.php:493
Stack trace:
#0 /var/www/html/vendor/colinmollenhour/credis/Client.php(489): Credis_Client->connect()
#1 /var/www/html/vendor/colinmollenhour/credis/Client.php(811): Credis_Client->connect()
#2 /var/www/html/vendor/colinmollenhour/cache-backend-redis/Cm/Cache/Backend/Redis.php(472): Credis_Client->__call('hGet', Array)
#3 /var/www/html/vendor/magento/framework/Cache/Backend/Redis.php(61): Cm_Cache_Backend_Redis->load('19d_GLOBAL__DIC...', false)
#4 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache/Core.php(306): Magento\Framework\Cache\Backend\Redis->load('19d_GLOBAL__DIC...', false)
#5 /var/www/html/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(55): Zend_Cache_Core->load('19d_GLOBAL__DIC...')
#6 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(65): Magento\Framework\Cache\Frontend\Adap in
<b>/var/www/html/vendor/colinmollenhour/credis/Client.php</b>
on line
<b>493</b>
Solution on the problem in my case is to change No database from “0” to “10”.
Env.php config: cache -> frontend -> default -> backend_options -> database:
// ....
'cache' => [
'frontend' => [
'default' => [
'id_prefix' => '19d_',
'backend' => 'Magento\\Framework\\Cache\\Backend\\Redis',
'backend_options' => [
'server' => 'redis',
'database' => '10', // change from 0 to 10
'port' => '6379',
'password' => '',
'compress_data' => '1',
'compression_lib' => ''
]
],
'page_cache' => [
'id_prefix' => '19d_',
'backend' => 'Magento\\Framework\\Cache\\Backend\\Redis',
'backend_options' => [
'server' => 'redis',
'database' => '20', // change from 1 to 20
'port' => '6379',
'password' => '',
'compress_data' => '0',
'compression_lib' => ''
]
]
],
'allow_parallel_generation' => false
],
// ...
Docker image – redis:6.0-alpine
Tested in Magento 2.4.3