{"id":15714,"date":"2023-06-02T11:39:08","date_gmt":"2023-06-02T11:39:08","guid":{"rendered":"https:\/\/cloudkul.com\/blog\/?p=15714"},"modified":"2023-06-27T06:41:53","modified_gmt":"2023-06-27T06:41:53","slug":"how-to-configure-redis-session-in-magento2","status":"publish","type":"post","link":"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/","title":{"rendered":"How to Configure Redis Session in Magento2"},"content":{"rendered":"\n<p><strong>What is Redis?<\/strong><\/p>\n\n\n\n<p>Redis is a free and open-source in-memory data structure store that can be used to function as a database, cache, or message broker. It is known for its great performance, ease of use, and versatility.<\/p>\n\n\n\n<p>Its main purpose is to store data in key-value, where each key is associated with a value. It also offers various types of data structures like strings, lists, sets, hashes, etc.<\/p>\n\n\n\n<p>However, It mostly stores the data in RAM, which allows highly rapid and performance operations. It also allows you to save data to disc on a regular basis or on an ad hoc basis.<\/p>\n\n\n\n<p>Therefore, with its help, you can reduce the stress on databases or other back-end systems by caching data in Redis which allows for a decrease in the response time of the application.<\/p>\n\n\n\n<p><strong>How to install Redis<\/strong>?<\/p>\n\n\n\n<p>To set up a Redis session in Magento, it should be installed on your server. If it is not installed on the server, you can install it using the below command in the Ubuntu system.<\/p>\n\n\n\n<p>For installation on other OS <a href=\"https:\/\/redis.io\/docs\/getting-started\/\" target=\"_blank\" rel=\"noreferrer noopener\">Click here!<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt update\nsudo apt install redis-server -y\n\n<\/pre>\n\n\n\n<p><strong>Verify the status of the Redis service<\/strong><\/p>\n\n\n\n<p>After installing the service, you can check the status of the service by using the below command<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo service redis-server status\n\n<\/pre>\n\n\n\n<p>you should get the below output which simply shows that the service is up and running.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/05\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"314\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/05\/image-1024x314.png\" alt=\"redis\" class=\"wp-image-15730\"\/><\/a><\/figure>\n\n\n\n<p><strong>How to Configure Magento2 to use Redis for session storage?<\/strong><\/p>\n\n\n\n<p>Magento2 now supports Redis session storage configuration through the command line, to enable this you need to run the below-mentioned command in the document root path of Magento.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo bin\/magento setup:config:set --session-save=redis --session-save-redis-host=127.0.0.1 --session-save-redis-log-level=4 --session-save-redis-db=2<\/pre>\n\n\n\n<p> and then press &#8216;Y&#8217;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/05\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"460\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/05\/image-1-1024x460.png\" alt=\"redis\" class=\"wp-image-15739\"\/><\/a><\/figure>\n\n\n\n<p>To verify that Redis and Magento are working together, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">redis-cli monitor\n<\/pre>\n\n\n\n<p>Refresh your storefront page and you\u2019ll see output similar to the following<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/05\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"319\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/05\/image-2-1024x319.png\" alt=\"redis\" class=\"wp-image-15742\"\/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Need Support?<\/h2>\n\n\n\n<p>Thank You for reading this Blog!<\/p>\n\n\n\n<p>For further more interesting blogs, keep in touch with us. If you need any kind of support, simply raise a ticket at&nbsp;<strong><a href=\"https:\/\/webkul.uvdesk.com\/en\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/webkul.uvdesk.com\/en\/<\/a>.<\/strong><\/p>\n\n\n\n<p>You may also visit our Odoo development services and quality&nbsp;<strong><a href=\"https:\/\/store.webkul.com\/index.php\/Odoo.html\">Odoo Extensions<\/a><\/strong>.<\/p>\n\n\n\n<p><strong>For further help or query, please&nbsp;<a href=\"https:\/\/cloudkul.com\/contact\/\">contact<\/a>&nbsp;us or raise a&nbsp;<a href=\"https:\/\/webkul.uvdesk.com\/en\/customer\/create-ticket\/\">ticket<\/a>.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Redis? Redis is a free and open-source in-memory data structure store that can <a class=\"text-primary\" title=\"read more\" href=\"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":38,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[2,87,20,341,25],"tags":[159,90,24,27,210],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Configure Redis Session in Magento2 - Cloudkul<\/title>\n<meta name=\"description\" content=\"Redis is a free and open-source in-memory data structure store that can function as a database, cache, or message broker.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Configure Redis Session in Magento2 - Cloudkul\" \/>\n<meta property=\"og:description\" content=\"Redis is a free and open-source in-memory data structure store that can function as a database, cache, or message broker.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudkul\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-02T11:39:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-27T06:41:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/05\/image-1024x314.png\" \/>\n<meta name=\"author\" content=\"Saransh Gupta\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/\",\"url\":\"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/\",\"name\":\"How to Configure Redis Session in Magento2 - Cloudkul\",\"isPartOf\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\"},\"datePublished\":\"2023-06-02T11:39:08+00:00\",\"dateModified\":\"2023-06-27T06:41:53+00:00\",\"author\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/192dfa8a1a34baf98d1dcd9b9f2cbdb4\"},\"description\":\"Redis is a free and open-source in-memory data structure store that can function as a database, cache, or message broker.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Configure Redis Session in Magento2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\",\"url\":\"https:\/\/cloudkul.com\/blog\/\",\"name\":\"Cloudkul\",\"description\":\"Host your eCommerce Store on AWS with Optimized Performance\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudkul.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/192dfa8a1a34baf98d1dcd9b9f2cbdb4\",\"name\":\"Saransh Gupta\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/90cd23bb6492ae259a2882d76832579a?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/90cd23bb6492ae259a2882d76832579a?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"caption\":\"Saransh Gupta\"},\"url\":\"https:\/\/cloudkul.com\/blog\/author\/saranshgupta-cloud712\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Configure Redis Session in Magento2 - Cloudkul","description":"Redis is a free and open-source in-memory data structure store that can function as a database, cache, or message broker.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/","og_locale":"en_US","og_type":"article","og_title":"How to Configure Redis Session in Magento2 - Cloudkul","og_description":"Redis is a free and open-source in-memory data structure store that can function as a database, cache, or message broker.","og_url":"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/","og_site_name":"Cloudkul","article_published_time":"2023-06-02T11:39:08+00:00","article_modified_time":"2023-06-27T06:41:53+00:00","og_image":[{"url":"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2023\/05\/image-1024x314.png"}],"author":"Saransh Gupta","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/","url":"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/","name":"How to Configure Redis Session in Magento2 - Cloudkul","isPartOf":{"@id":"https:\/\/cloudkul.com\/blog\/#website"},"datePublished":"2023-06-02T11:39:08+00:00","dateModified":"2023-06-27T06:41:53+00:00","author":{"@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/192dfa8a1a34baf98d1dcd9b9f2cbdb4"},"description":"Redis is a free and open-source in-memory data structure store that can function as a database, cache, or message broker.","breadcrumb":{"@id":"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cloudkul.com\/blog\/how-to-configure-redis-session-in-magento2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Configure Redis Session in Magento2"}]},{"@type":"WebSite","@id":"https:\/\/cloudkul.com\/blog\/#website","url":"https:\/\/cloudkul.com\/blog\/","name":"Cloudkul","description":"Host your eCommerce Store on AWS with Optimized Performance","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudkul.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/192dfa8a1a34baf98d1dcd9b9f2cbdb4","name":"Saransh Gupta","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/90cd23bb6492ae259a2882d76832579a?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/90cd23bb6492ae259a2882d76832579a?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","caption":"Saransh Gupta"},"url":"https:\/\/cloudkul.com\/blog\/author\/saranshgupta-cloud712\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/15714"}],"collection":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/users\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/comments?post=15714"}],"version-history":[{"count":55,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/15714\/revisions"}],"predecessor-version":[{"id":15808,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/15714\/revisions\/15808"}],"wp:attachment":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/media?parent=15714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/categories?post=15714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/tags?post=15714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}