{"id":1881,"date":"2015-04-23T10:18:50","date_gmt":"2015-04-23T10:18:50","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=1881"},"modified":"2023-08-03T08:06:13","modified_gmt":"2023-08-03T07:06:13","slug":"what-is-redis-and-how-to-install-it","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","title":{"rendered":"What Is Redis And How To Install It ?"},"content":{"rendered":"<p>What Is Redis ?<\/p>\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<p><strong><em>Install Redis Daemon<\/em><\/strong><\/p>\n<blockquote><p>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<\/p><\/blockquote>\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<blockquote><p>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<\/p><\/blockquote>\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<blockquote><p>#!\/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<\/p>\n<p># Source function library.<br \/>\n. \/etc\/rc.d\/init.d\/functions<\/p>\n<p># Source networking configuration.<br \/>\n. \/etc\/sysconfig\/network<\/p>\n<p># Check that networking is up.<br \/>\n[ &#8220;$NETWORKING&#8221; = &#8220;no&#8221; ] &amp;&amp; exit 0<\/p>\n<p>redis=&#8221;\/usr\/local\/bin\/redis-server&#8221;<br \/>\nprog=$(basename $redis)<\/p>\n<p>REDIS_CONF_FILE=&#8221;\/etc\/redis\/redis.conf&#8221;<\/p>\n<p>[ -f \/etc\/sysconfig\/redis ] &amp;&amp; . \/etc\/sysconfig\/redis<\/p>\n<p>lockfile=\/var\/lock\/subsys\/redis<\/p>\n<p>start() {<br \/>\n[ -x $redis ] || exit 5<br \/>\n[ -f $REDIS_CONF_FILE ] || exit 6<br \/>\necho -n $&#8221;Starting $prog: &#8221;<br \/>\ndaemon $redis $REDIS_CONF_FILE<br \/>\nretval=$?<br \/>\necho<br \/>\n[ $retval -eq 0 ] &amp;&amp; touch $lockfile<br \/>\nreturn $retval<br \/>\n}<\/p>\n<p>stop() {<br \/>\necho -n $&#8221;Stopping $prog: &#8221;<br \/>\nkillproc $prog -QUIT<br \/>\nretval=$?<br \/>\necho<br \/>\n[ $retval -eq 0 ] &amp;&amp; rm -f $lockfile<br \/>\nreturn $retval<br \/>\n}<\/p>\n<p>restart() {<br \/>\nstop<br \/>\nstart<br \/>\n}<\/p>\n<p>reload() {<br \/>\necho -n $&#8221;Reloading $prog: &#8221;<br \/>\nkillproc $redis -HUP<br \/>\nRETVAL=$?<br \/>\necho<br \/>\n}<\/p>\n<p>force_reload() {<br \/>\nrestart<br \/>\n}<\/p>\n<p>rh_status() {<br \/>\nstatus $prog<br \/>\n}<\/p>\n<p>rh_status_q() {<br \/>\nrh_status &gt;\/dev\/null 2&gt;&amp;1<br \/>\n}<\/p>\n<p>case &#8220;$1&#8243; in<br \/>\nstart)<br \/>\nrh_status_q &amp;&amp; exit 0<br \/>\n$1<br \/>\n;;<br \/>\nstop)<br \/>\nrh_status_q || exit 0<br \/>\n$1<br \/>\n;;<br \/>\nrestart|configtest)<br \/>\n$1<br \/>\n;;<br \/>\nreload)<br \/>\nrh_status_q || exit 7<br \/>\n$1<br \/>\n;;<br \/>\nforce-reload)<br \/>\nforce_reload<br \/>\n;;<br \/>\nstatus)<br \/>\nrh_status<br \/>\n;;<br \/>\ncondrestart|try-restart)<br \/>\nrh_status_q || exit 0<br \/>\n;;<br \/>\n*)<br \/>\necho $&#8221;Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}&#8221;<br \/>\nexit 2<br \/>\nesac<\/p><\/blockquote>\n<p>Update the system services &amp; configure redis daemon to start after server reboot.<\/p>\n<blockquote><p>chkconfig &#8211;add redis<br \/>\nchkconfig redis on<\/p><\/blockquote>\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<blockquote><p>\/etc\/init.d\/redis start<\/p><\/blockquote>\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<blockquote><p>pecl install redis<\/p><\/blockquote>\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 v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What Is Redis And How To Install It ?<\/title>\n<meta name=\"description\" content=\"This comprehensive guide provides insights into Redis and its various applications. Follow our step-by-step instructions to install Redis on your server and harness the benefits of its blazing-fast performance and data caching capabilities.\" \/>\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.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\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=\"This comprehensive guide provides insights into Redis and its various applications. Follow our step-by-step instructions to install Redis on your server and harness the benefits of its blazing-fast performance and data caching capabilities.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/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=\"2023-08-03T07:06:13+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=\"Estimated 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\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\",\"name\":\"What Is Redis And How To Install It ?\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"datePublished\":\"2015-04-23T10:18:50+00:00\",\"dateModified\":\"2023-08-03T07:06:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69\"},\"description\":\"This comprehensive guide provides insights into Redis and its various applications. Follow our step-by-step instructions to install Redis on your server and harness the benefits of its blazing-fast performance and data caching capabilities.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What Is Redis And How To Install It ?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/42e5b55cc2772cd685c8803f6f7f854b?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/42e5b55cc2772cd685c8803f6f7f854b?s=96&d=blank&r=g\",\"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.co.uk\/hosting-faqs\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What Is Redis And How To Install It ?","description":"This comprehensive guide provides insights into Redis and its various applications. Follow our step-by-step instructions to install Redis on your server and harness the benefits of its blazing-fast performance and data caching capabilities.","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.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","og_locale":"en_GB","og_type":"article","og_title":"What Is Redis And How To Install It ?","og_description":"This comprehensive guide provides insights into Redis and its various applications. Follow our step-by-step instructions to install Redis on your server and harness the benefits of its blazing-fast performance and data caching capabilities.","og_url":"https:\/\/www.milesweb.co.uk\/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":"2023-08-03T07:06:13+00:00","author":"admin","twitter_misc":{"Written by":"admin","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/","name":"What Is Redis And How To Install It ?","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"datePublished":"2015-04-23T10:18:50+00:00","dateModified":"2023-08-03T07:06:13+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69"},"description":"This comprehensive guide provides insights into Redis and its various applications. Follow our step-by-step instructions to install Redis on your server and harness the benefits of its blazing-fast performance and data caching capabilities.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/what-is-redis-and-how-to-install-it\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"What Is Redis And How To Install It ?"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/90143c7d8df4b4de36b3dbb0bb272f69","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/42e5b55cc2772cd685c8803f6f7f854b?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/42e5b55cc2772cd685c8803f6f7f854b?s=96&d=blank&r=g","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.co.uk\/hosting-faqs\/author\/admin\/"}]}},"views":1692,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/1881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=1881"}],"version-history":[{"count":4,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/1881\/revisions"}],"predecessor-version":[{"id":14933,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/1881\/revisions\/14933"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=1881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=1881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=1881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}