MAGENTO

How to configure sessions by Redis in Magento2 using the Unix Socket

The session can be configured in two ways.

  1. Configure caching by editing the file env.php
  2. Using the CLI tool

Session socket is runnning in the following sock
/var/run/redis-multi.redis/redis.sock

Config the editig by env.php

‘session’ => [
‘save’ => ‘redis’,
‘redis’ => [
‘host’ => ‘/var/run/redis-multi.redis/redis.sock’,
‘port’ => ‘0’,
‘password’ => ”,
‘timeout’ => ‘2.5’,
‘persistent_identifier’ => ”,
‘database’ => ‘0’,
‘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’,
‘sentinel_master’ => ”,
‘sentinel_servers’ => ”,
‘sentinel_connect_retries’ => ‘5’,
‘sentinel_verify_master’ => ‘0’
]
],

Config thru CLI Tools

Below are command which we used to configure the session by Redis in Magento2

php bin/magento setup:config:set –session-save=redis –session-save-redis-host=/var/run/redis-multi.redis/redis.sock –session-save-redis-log-level=3 –session-save-redis-db=0 –session-save-redis-port=0

Free Web Hosting