{"id":93,"date":"2019-08-14T02:00:25","date_gmt":"2019-08-14T02:00:25","guid":{"rendered":"http:\/\/www.sureshselvam.com\/?p=93"},"modified":"2021-04-27T12:40:18","modified_gmt":"2021-04-27T12:40:18","slug":"how-to-configure-redis-cache-in-magento2-using-the-unix-socket","status":"publish","type":"post","link":"https:\/\/www.sureshselvam.com\/index.php\/2019\/08\/14\/how-to-configure-redis-cache-in-magento2-using-the-unix-socket\/","title":{"rendered":"How to configure redis cache in Magento2 using the Unix Socket"},"content":{"rendered":"<p><b>Redis cache can be configured in two ways.<\/b><\/p>\n<ol>\n<li>Configure caching by editing the file env.php<\/li>\n<li>Using the CLI tool<\/li>\n<\/ol>\n<p>For Example<\/p>\n<p>Redis Cache is running in the following sock\u00a0 \/var\/run\/redis-multi.redis\/redis.sock<\/p>\n<p><b>Configure caching by editing <\/b><b>the file env.php<\/b><\/p>\n<p>Below lines needs to add in env.php file.<\/p>\n<p><em>&#8216;cache&#8217; =&gt; [<br \/>\n&#8216;frontend&#8217; =&gt; [<br \/>\n&#8216;default&#8217; =&gt; [<br \/>\n&#8216;id_prefix&#8217; =&gt; &#8216;8ad_&#8217;,<br \/>\n&#8216;backend&#8217; =&gt; &#8216;Cm_Cache_Backend_Redis&#8217;,<br \/>\n&#8216;backend_options&#8217; =&gt; [<br \/>\n&#8216;server&#8217; =&gt; &#8216;\/var\/run\/redis-multi.redis\/redis.sock&#8217;,<br \/>\n&#8216;database&#8217; =&gt; &#8216;0&#8217;,<br \/>\n&#8216;port&#8217; =&gt; &#8216;0&#8217;,<br \/>\n&#8216;password&#8217; =&gt; &#8221;<br \/>\n]<br \/>\n],<br \/>\n&#8216;page_cache&#8217; =&gt; [<br \/>\n&#8216;id_prefix&#8217; =&gt; &#8216;8ad_&#8217;,<br \/>\n&#8216;backend&#8217; =&gt; &#8216;Cm_Cache_Backend_Redis&#8217;,<br \/>\n&#8216;backend_options&#8217; =&gt; [<br \/>\n&#8216;server&#8217; =&gt; &#8216;\/var\/run\/redis-multi.redis\/redis.sock&#8217;,<br \/>\n&#8216;database&#8217; =&gt; &#8216;1&#8217;,<br \/>\n&#8216;port&#8217; =&gt; &#8216;0&#8217;,<br \/>\n&#8216;compress_data&#8217; =&gt; &#8216;0&#8217;,<br \/>\n&#8216;password&#8217; =&gt; &#8221;<br \/>\n]<br \/>\n]<br \/>\n]<br \/>\n],<\/em><\/p>\n<p><b>Using CLI tool<\/b><\/p>\n<p>Below are commands which we used to configure the redis cache in Magento2<\/p>\n<p><strong>Cache<\/strong><\/p>\n<p><em>php bin\/magento setup:config:set &#8211;cache-backend=redis &#8211;cache-backend-redis-server=\/var\/run\/redis-multi.redis\/redis.sock &#8211;cache-backend-redis-db=0 &#8211;cache-backend-redis-port=0;<\/em><\/p>\n<p><strong>PageCache<\/strong><\/p>\n<p><em>php bin\/magento setup:config:set &#8211;page-cache=redis &#8211;page-cache-redis-server=\/var\/run\/redis-multi.redis\/redis.sock &#8211;page-cache-redis-db=1 &#8211;page-cache-redis-port=0;<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Redis cache can be configured in two ways. Configure caching by editing the file env.php Using the CLI tool For Example Redis Cache is running in the following sock\u00a0 \/var\/run\/redis-multi.redis\/redis.sock Configure caching by editing the file env.php Below lines needs to add in env.php file. &#8216;cache&#8217; =&gt; [ &#8216;frontend&#8217; =&gt; [ &#8216;default&#8217; =&gt; [ &#8216;id_prefix&#8217; =&gt; &#8216;8ad_&#8217;, &#8216;backend&#8217; =&gt; &#8216;Cm_Cache_Backend_Redis&#8217;, &#8216;backend_options&#8217; =&gt; [ &#8216;server&#8217; =&gt; &#8216;\/var\/run\/redis-multi.redis\/redis.sock&#8217;, &#8216;database&#8217; =&gt; &#8216;0&#8217;, &#8216;port&#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-93","post","type-post","status-publish","format-standard","hentry","category-magento"],"_links":{"self":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/93","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=93"}],"version-history":[{"count":3,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/93\/revisions"}],"predecessor-version":[{"id":96,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/93\/revisions\/96"}],"wp:attachment":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/media?parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/categories?post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/tags?post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}