[Solved] Connection to Redis failed after x failures Client.php Credis_Client->connect
Issue:-
[[email protected] ~]# cd /home/the-d2/public_html/var/report/ [[email protected] report]# cat 118233337366 a:4:{i:0;s:44:"Connection to Redis failed after 2 failures.";i:1;s:1529:"#0 /home/the-d2/public_html/lib/Credis/Client.php(362): Credis_Client->connect() #1 /home/the-d2/public_html/lib/Credis/Client.php(447): Credis_Client->connect() #2 /home/the-d2/public_html/lib/Credis/Client.php(440): Credis_Client->__call('select', Array) #3 /home/the-d2/public_html/lib/Cm/Cache/Backend/Redis.php(117): Credis_Client->select(0) #4 /home/the-d2/public_html/lib/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array) #5 /home/the-d2/public_html/lib/Zend/Cache.php(94): Zend_Cache::_makeBackend('Cm_Cache_Backen...', Array, true, true) #6 /home/the-d2/public_html/app/code/core/Mage/Core/Model/Cache.php(137): Zend_Cache::factory('Varien_Cache_Co...', 'Cm_Cache_Backen...', Array, Array, true, true, true) #7 /home/the-d2/public_html/app/code/core/Mage/Core/Model/Config.php(1354): Mage_Core_Model_Cache->__construct(Array) #8 /home/the-d2/public_html/app/Mage.php(463): Mage_Core_Model_Config->getModelInstance('core/cache', Array) #9 /home/the-d2/public_html/app/code/core/Mage/Core/Model/App.php(401): Mage::getModel('core/cache', Array) #10 /home/the-d2/public_html/app/code/core/Mage/Core/Model/App.php(295): Mage_Core_Model_App->_initCache(Array) #11 /home/the-d2/public_html/app/code/core/Mage/Core/Model/App.php(337): Mage_Core_Model_App->baseInit(Array) #12 /home/the-d2/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array) #13 /home/the-d2/public_html/index.php(98): Mage::run('', 'store') #14 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";} [[email protected] report]# redis-cli flushall Could not connect to Redis at 127.0.0.1:6379: Connection refused [[email protected] report]# service redis status Redirecting to /bin/systemctl status redis.service ● redis.service - Redis persistent key-value database Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/redis.service.d └─limit.conf Active: failed (Result: exit-code) since Wed 2019-10-27 22:47:11 IST; 9min ago Process: 29554 ExecStop=/usr/libexec/redis-shutdown (code=exited, status=1/FAILURE) Process: 15882 ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd (code=killed, signal=KILL) Main PID: 15882 (code=killed, signal=KILL) Oct 27 22:47:11 server.the-d2.com systemd[1]: redis.service: main process exited, code=killed, status=9/KILL Oct 27 22:47:11 server.the-d2.com redis-shutdown[29554]: Could not connect to Redis at 127.0.0.1:6379: Connection refused Oct 27 22:47:11 server.the-d2.com systemd[1]: redis.service: control process exited, code=exited status=1 Oct 27 22:47:11 server.the-d2.com systemd[1]: Unit redis.service entered failed state. Oct 27 22:47:11 server.the-d2.com systemd[1]: redis.service failed.
Solution:- Restart redis service then check memory bottleneck cause
[[email protected] report]# service redis restart Redirecting to /bin/systemctl restart redis.service [[email protected] report]# service redis status Redirecting to /bin/systemctl status redis.service ● redis.service - Redis persistent key-value database Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/redis.service.d └─limit.conf Active: active (running) since Wed 2019-10-27 22:56:12 IST; 1s ago Process: 29554 ExecStop=/usr/libexec/redis-shutdown (code=exited, status=1/FAILURE) Main PID: 3416 (redis-server) CGroup: /system.slice/redis.service └─3416 /usr/bin/redis-server 127.0.0.1:6379 Oct 27 22:56:12 server.the-d2.com systemd[1]: Starting Redis persistent key-value database... Oct 27 22:56:12 server.the-d2.com systemd[1]: Started Redis persistent key-value database.