{"id":1881,"date":"2015-04-23T10:18:50","date_gmt":"2015-04-23T10:18:50","guid":{"rendered":"https:\/\/www.milesweb.com\/hosting-faqs\/?p=1881"},"modified":"2018-05-19T12:10:29","modified_gmt":"2018-05-19T12:10:29","slug":"what-is-redis-and-how-to-install-it","status":"publish","type":"post","link":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","title":{"rendered":"What Is Redis And How To Install It?"},"content":{"rendered":"<h3><strong>What is Redis?<\/strong><\/h3>\n<p>Redis is an BSD licensed, open source, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs. Refer <strong>redis.io\/topics\/introduction<\/strong> to know more about Redis. <!--more--><\/p>\n<p>We will learn how to install redis on a CentOS cPanel server. On a CentOS cPanel server, we will need to install redis daemon &amp; the redis PHP extension. Once installed &amp; enabled it helps in boosting the eCommerce website performance.<\/p>\n<h3><strong>Install Redis Daemon<\/strong><\/h3>\n<p><strong>cd \/usr\/local\/<br \/>\nwget http:\/\/download.redis.io\/releases\/redis-2.8.12.tar.gz<br \/>\ntar -xvzf redis-2.8.12.tar.gz<br \/>\ncd redis-2.8.12<br \/>\nmake<br \/>\ncp src\/redis-server \/usr\/local\/bin<br \/>\ncp src\/redis-cli \/usr\/local\/bin<br \/>\nmkdir -p \/etc\/redis<br \/>\nmkdir -p \/var\/redis<br \/>\ncp redis.conf \/etc\/redis\/redis.conf<\/strong><\/p>\n<p>Now, let&#8217;s edit \/etc\/redis\/redis.conf &amp; configure it to work with the server. Set the values as below.<\/p>\n<p><strong>daemonize yes<br \/>\nport 6379<br \/>\nbind 127.0.0.1<br \/>\ndir \/var\/redis\/<br \/>\nlogfile \/var\/log\/redis.log<br \/>\npidfile \/var\/run\/redis.pid<\/strong><\/p>\n<p>We will now need a startup script which will start, stop, restart redis on your server. Create a file \/etc\/init.d\/redis &amp; add below content. Set permissions to 755 so that the file is executable.<\/p>\n<p><strong>#!\/bin\/sh<br \/>\n#<br \/>\n# redis &#8211; this script starts and stops the redis-server daemon<br \/>\n#<br \/>\n# chkconfig: &#8211; 85 15<br \/>\n# description: Redis is a persistent key-value database<br \/>\n# processname: redis-server<br \/>\n# config: \/etc\/redis\/redis.conf<br \/>\n# config: \/etc\/sysconfig\/redis<br \/>\n# pidfile: \/var\/run\/redis.pid<\/strong><\/p>\n<p><strong># Source function library.<\/strong><br \/>\n<strong> . \/etc\/rc.d\/init.d\/functions<\/strong><\/p>\n<p><strong># Source networking configuration.<\/strong><br \/>\n<strong> . \/etc\/sysconfig\/network<\/strong><\/p>\n<p><strong># Check that networking is up.<\/strong><br \/>\n<strong> [ &#8220;$NETWORKING&#8221; = &#8220;no&#8221; ] &amp;&amp; exit 0<\/strong><\/p>\n<p><strong>redis=&#8221;\/usr\/local\/bin\/redis-server&#8221;<\/strong><br \/>\n<strong> prog=$(basename $redis)<\/strong><\/p>\n<p><strong>REDIS_CONF_FILE=&#8221;\/etc\/redis\/redis.conf&#8221;<\/strong><\/p>\n<p><strong>[ -f \/etc\/sysconfig\/redis ] &amp;&amp; . \/etc\/sysconfig\/redis<\/strong><\/p>\n<p><strong>lockfile=\/var\/lock\/subsys\/redis<\/strong><\/p>\n<p><strong>start() {<\/strong><br \/>\n<strong> [ -x $redis ] || exit 5<\/strong><br \/>\n<strong> [ -f $REDIS_CONF_FILE ] || exit 6<\/strong><br \/>\n<strong> echo -n $&#8221;Starting $prog: &#8220;<\/strong><br \/>\n<strong> daemon $redis $REDIS_CONF_FILE<\/strong><br \/>\n<strong> retval=$?<\/strong><br \/>\n<strong> echo<\/strong><br \/>\n<strong> [ $retval -eq 0 ] &amp;&amp; touch $lockfile<\/strong><br \/>\n<strong> return $retval<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>stop() {<\/strong><br \/>\n<strong> echo -n $&#8221;Stopping $prog: &#8220;<\/strong><br \/>\n<strong> killproc $prog -QUIT<\/strong><br \/>\n<strong> retval=$?<\/strong><br \/>\n<strong> echo<\/strong><br \/>\n<strong> [ $retval -eq 0 ] &amp;&amp; rm -f $lockfile<\/strong><br \/>\n<strong> return $retval<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>restart() {<\/strong><br \/>\n<strong> stop<\/strong><br \/>\n<strong> start<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>reload() {<\/strong><br \/>\n<strong> echo -n $&#8221;Reloading $prog: &#8220;<\/strong><br \/>\n<strong> killproc $redis -HUP<\/strong><br \/>\n<strong> RETVAL=$?<\/strong><br \/>\n<strong> echo<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>force_reload() {<\/strong><br \/>\n<strong> restart<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>rh_status() {<\/strong><br \/>\n<strong> status $prog<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>rh_status_q() {<\/strong><br \/>\n<strong> rh_status &gt;\/dev\/null 2&gt;&amp;1<\/strong><br \/>\n<strong> }<\/strong><\/p>\n<p><strong>case &#8220;$1&#8221; in<\/strong><br \/>\n<strong> start)<\/strong><br \/>\n<strong> rh_status_q &amp;&amp; exit 0<\/strong><br \/>\n<strong> $1<\/strong><br \/>\n<strong> ;;<\/strong><br \/>\n<strong> stop)<\/strong><br \/>\n<strong> rh_status_q || exit 0<\/strong><br \/>\n<strong> $1<\/strong><br \/>\n<strong> ;;<\/strong><br \/>\n<strong> restart|configtest)<\/strong><br \/>\n<strong> $1<\/strong><br \/>\n<strong> ;;<\/strong><br \/>\n<strong> reload)<\/strong><br \/>\n<strong> rh_status_q || exit 7<\/strong><br \/>\n<strong> $1<\/strong><br \/>\n<strong> ;;<\/strong><br \/>\n<strong> force-reload)<\/strong><br \/>\n<strong> force_reload<\/strong><br \/>\n<strong> ;;<\/strong><br \/>\n<strong> status)<\/strong><br \/>\n<strong> rh_status<\/strong><br \/>\n<strong> ;;<\/strong><br \/>\n<strong> condrestart|try-restart)<\/strong><br \/>\n<strong> rh_status_q || exit 0<\/strong><br \/>\n<strong> ;;<\/strong><br \/>\n<strong> *)<\/strong><br \/>\n<strong> echo $&#8221;Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}&#8221;<\/strong><br \/>\n<strong> exit 2<\/strong><br \/>\n<strong> esac<\/strong><\/p>\n<p>Update the system services &amp; configure redis daemon to start after server reboot.<\/p>\n<p><strong>chkconfig &#8211;add redis<br \/>\nchkconfig redis on<\/strong><\/p>\n<p>Start the redis service with command below. You can use command <strong>redis-cli ping<\/strong> to check if it works properly. If you get a result PONG it means redis is working.<\/p>\n<p><strong>\/etc\/init.d\/redis start<\/strong><\/p>\n<p>To know more about the command and it&#8217;s options use <strong>redis-cli &#8211;help<\/strong>.<\/p>\n<p><strong>Inst<em>all Redis PHP Extension<\/em><\/strong><\/p>\n<p>Redis PHP extension is installed by performing couple of commands.<\/p>\n<p><strong>pecl install redis<\/strong><\/p>\n<p>Open the server&#8217;s php.ini file &amp; add <strong>extension=redis.so<\/strong> to it. You can get the server&#8217;s php.ini file with command <strong>php -i | grep php.ini<\/strong>. Restart apache (your web server) &amp; you are done.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Redis? Redis is an BSD licensed, open source, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs. Refer redis.io\/topics\/introduction to know more about Redis.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-1881","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What Is Redis And How To Install It?<\/title>\n<meta name=\"description\" content=\"Redis is an BSD licensed, open source, advanced key-value cache and store.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What Is Redis And How To Install It?\" \/>\n<meta property=\"og:description\" content=\"Redis is an BSD licensed, open source, advanced key-value cache and store.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2015-04-23T10:18:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-05-19T12:10:29+00:00\" \/>\n<meta name=\"author\" content=\"Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\"},\"author\":{\"name\":\"Admin\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69\"},\"headline\":\"What Is Redis And How To Install It?\",\"datePublished\":\"2015-04-23T10:18:50+00:00\",\"dateModified\":\"2018-05-19T12:10:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\"},\"wordCount\":557,\"commentCount\":0,\"articleSection\":[\"How-Tos\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\",\"name\":\"What Is Redis And How To Install It?\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\"},\"datePublished\":\"2015-04-23T10:18:50+00:00\",\"dateModified\":\"2018-05-19T12:10:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69\"},\"description\":\"Redis is an BSD licensed, open source, advanced key-value cache and store.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What Is Redis And How To Install It?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69\",\"name\":\"Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/02\/MilesWeb-Logo-150x150.png\",\"contentUrl\":\"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/02\/MilesWeb-Logo-150x150.png\",\"caption\":\"Admin\"},\"description\":\"With over 10+ years of experience in the web hosting industry, I have achieved extensive exposure to result-oriented methodologies. And expertise in different domains like Datacentre Services, Cloud computing technology, Web hosting industry and many more.\",\"url\":\"https:\/\/www.milesweb.in\/hosting-faqs\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What Is Redis And How To Install It?","description":"Redis is an BSD licensed, open source, advanced key-value cache and store.","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:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","og_locale":"en_US","og_type":"article","og_title":"What Is Redis And How To Install It?","og_description":"Redis is an BSD licensed, open source, advanced key-value cache and store.","og_url":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2015-04-23T10:18:50+00:00","article_modified_time":"2018-05-19T12:10:29+00:00","author":"Admin","twitter_misc":{"Written by":"Admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#article","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/"},"author":{"name":"Admin","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69"},"headline":"What Is Redis And How To Install It?","datePublished":"2015-04-23T10:18:50+00:00","dateModified":"2018-05-19T12:10:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/"},"wordCount":557,"commentCount":0,"articleSection":["How-Tos"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","name":"What Is Redis And How To Install It?","isPartOf":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website"},"datePublished":"2015-04-23T10:18:50+00:00","dateModified":"2018-05-19T12:10:29+00:00","author":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69"},"description":"Redis is an BSD licensed, open source, advanced key-value cache and store.","breadcrumb":{"@id":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.in\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"What Is Redis And How To Install It?"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.in\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.in\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69","name":"Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.milesweb.in\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/02\/MilesWeb-Logo-150x150.png","contentUrl":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-content\/uploads\/2020\/02\/MilesWeb-Logo-150x150.png","caption":"Admin"},"description":"With over 10+ years of experience in the web hosting industry, I have achieved extensive exposure to result-oriented methodologies. And expertise in different domains like Datacentre Services, Cloud computing technology, Web hosting industry and many more.","url":"https:\/\/www.milesweb.in\/hosting-faqs\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/1881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=1881"}],"version-history":[{"count":8,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/1881\/revisions"}],"predecessor-version":[{"id":5089,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/posts\/1881\/revisions\/5089"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=1881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=1881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.in\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=1881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}