I am using Redis cache for session storage in my Magento 2.4.3-p2
based store.
The app/etc/env.php
setting looks like
'session' => [
'save' => 'redis',
'redis' => [
'host' => '<private-ip>',
'port' => '6380',
'password' => '',
'timeout' => '5',
'persistent_identifier' => '',
'database' => '2',
'compression_threshold' => '2048',
'compression_library' => 'gzip',
'log_level' => '3',
'max_concurrency' => '12',
'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'
]
],
Note: Redis is installed in a separate instance connected via private IP
And, I am frequently seeing the below errors in my server logs
- Warning:
session_write_close()
: Failed to write session data using user-defined save handler. (session.save_path: /var/lib/php/sessions) - Connection to Redis : failed after 1 failures.Last Error : (1) Connection refused
- read error on connection to :
Redis (v6.0.9) installed on Ubuntu 18.04 instance has 32 GB of RAM and the settings look like this:
maxmemory:1gb
maxmemory_policy:allkeys-lru
Any idea what could be the reason? and some debugging tips/tools?