{"id":107,"date":"2021-04-27T09:50:42","date_gmt":"2021-04-27T09:50:42","guid":{"rendered":"http:\/\/www.sureshselvam.com\/?p=107"},"modified":"2021-04-27T12:40:18","modified_gmt":"2021-04-27T12:40:18","slug":"how-to-configure-sessions-by-redis-in-magento2-using-the-unix-socket","status":"publish","type":"post","link":"https:\/\/www.sureshselvam.com\/index.php\/2021\/04\/27\/how-to-configure-sessions-by-redis-in-magento2-using-the-unix-socket\/","title":{"rendered":"How to configure sessions by Redis in Magento2 using the Unix Socket"},"content":{"rendered":"\n<p>The session can be configured in two ways.<\/p>\n\n\n\n<p><ol><li>Configure caching by editing the file env.php<\/li>\n<li>Using the CLI tool<\/li><\/ol><\/p>\n\n\n\n<p>Session socket is runnning in the following sock <br>\n \/var\/run\/redis-multi.redis\/redis.sock<\/p>\n\n\n\n<p><strong>Config the editig by env.php<\/strong><\/p>\n\n\n\n<p><em>&#8216;session&#8217; => [<br>         &#8216;save&#8217; => &#8216;redis&#8217;,<br>         &#8216;redis&#8217; => [<br>             &#8216;host&#8217; => &#8216;\/var\/run\/redis-multi.redis\/redis.sock&#8217;,<br>             &#8216;port&#8217; => &#8216;0&#8217;,<br>             &#8216;password&#8217; => &#8221;,<br>             &#8216;timeout&#8217; => &#8216;2.5&#8217;,<br>             &#8216;persistent_identifier&#8217; => &#8221;,<br>             &#8216;database&#8217; => &#8216;0&#8217;,<br>             &#8216;compression_threshold&#8217; => &#8216;2048&#8217;,<br>             &#8216;compression_library&#8217; => &#8216;gzip&#8217;,<br>             &#8216;log_level&#8217; => &#8216;3&#8217;,<br>             &#8216;max_concurrency&#8217; => &#8216;6&#8217;,<br>             &#8216;break_after_frontend&#8217; => &#8216;5&#8217;,<br>             &#8216;break_after_adminhtml&#8217; => &#8217;30&#8217;,<br>             &#8216;first_lifetime&#8217; => &#8216;600&#8217;,<br>             &#8216;bot_first_lifetime&#8217; => &#8217;60&#8217;,<br>             &#8216;bot_lifetime&#8217; => &#8216;7200&#8217;,<br>             &#8216;disable_locking&#8217; => &#8216;0&#8217;,<br>             &#8216;min_lifetime&#8217; => &#8217;60&#8217;,<br>             &#8216;max_lifetime&#8217; => &#8216;2592000&#8217;,<br>             &#8216;sentinel_master&#8217; => &#8221;,<br>             &#8216;sentinel_servers&#8217; => &#8221;,<br>             &#8216;sentinel_connect_retries&#8217; => &#8216;5&#8217;,<br>             &#8216;sentinel_verify_master&#8217; => &#8216;0&#8217;<br>         ]<br>     ],<\/em><\/p>\n\n\n\n<p><strong>Config thru CLI Tools<\/strong><\/p>\n\n\n\n<p>Below are command which we used to configure the session by Redis in Magento2<\/p>\n\n\n\n<p><em>php bin\/magento setup:config:set &#8211;session-save=redis &#8211;session-save-redis-host=\/var\/run\/redis-multi.redis\/redis.sock &#8211;session-save-redis-log-level=3 &#8211;session-save-redis-db=0 &#8211;session-save-redis-port=0<\/em><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The session can be configured in two ways. Configure caching by editing the file env.php 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 &#8216;session&#8217; => [ &#8216;save&#8217; => &#8216;redis&#8217;, &#8216;redis&#8217; => [ &#8216;host&#8217; => &#8216;\/var\/run\/redis-multi.redis\/redis.sock&#8217;, &#8216;port&#8217; => &#8216;0&#8217;, &#8216;password&#8217; => &#8221;, &#8216;timeout&#8217; => &#8216;2.5&#8217;, &#8216;persistent_identifier&#8217; => &#8221;, &#8216;database&#8217; => &#8216;0&#8217;, &#8216;compression_threshold&#8217; => &#8216;2048&#8217;, &#8216;compression_library&#8217; => &#8216;gzip&#8217;, &#8216;log_level&#8217; => &#8216;3&#8217;, &#8216;max_concurrency&#8217;&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-107","post","type-post","status-publish","format-standard","hentry","category-magento"],"_links":{"self":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/comments?post=107"}],"version-history":[{"count":2,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":109,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/107\/revisions\/109"}],"wp:attachment":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/media?parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/categories?post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/tags?post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}