{"id":1171,"date":"2016-12-17T14:51:19","date_gmt":"2016-12-17T22:51:19","guid":{"rendered":"http:\/\/www.developerscloset.com\/?page_id=1171"},"modified":"2018-05-17T14:55:49","modified_gmt":"2018-05-17T22:55:49","slug":"redis","status":"publish","type":"page","link":"https:\/\/www.developerscloset.com\/?page_id=1171","title":{"rendered":"Redis"},"content":{"rendered":"<p><a href=\"http:\/\/www.developerscloset.com\/wp-content\/uploads\/2018\/05\/redis-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1172 alignnone\" src=\"http:\/\/www.developerscloset.com\/wp-content\/uploads\/2018\/05\/redis-2.png\" alt=\"\" width=\"256\" height=\"92\" \/><\/a><\/p>\n<p>Redis is an open source, BSD licensed, advanced key-value cache and store. Redis is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, and bitmaps.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69ea231ff3f45\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69ea231ff3f45\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.developerscloset.com\/?page_id=1171\/#Install_Redis\" >Install Redis<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.developerscloset.com\/?page_id=1171\/#Install_an_Older_Version_of_Redis\" >Install an Older Version of Redis<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.developerscloset.com\/?page_id=1171\/#Configure_Redis\" >Configure Redis<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.developerscloset.com\/?page_id=1171\/#Retrieve_Version\" >Retrieve Version<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.developerscloset.com\/?page_id=1171\/#Configuration_File\" >Configuration File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.developerscloset.com\/?page_id=1171\/#Change_Default_Port\" >Change Default Port<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1 id=\"Redis-Installation\"><span class=\"ez-toc-section\" id=\"Install_Redis\"><\/span>Install Redis<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>1. Download a version from Redis.io\/downloads<\/p>\n<p>2. Copy to \/tmp<\/p>\n<p>3. Unzip files (tar -xvf filename)<\/p>\n<p>4. Enter into \/tmp\/redis-[version]<\/p>\n<p>5. Type sudo make MALLOC=libc\u00a0 (this compiles jemalloc as part of the make)<\/p>\n<p>6. When that finishes (do not use make test as jemalloc breaks make test)<\/p>\n<p>7. Create the install scripts:<\/p>\n<p>sudo make install<\/p>\n<p>8. enter utils:<\/p>\n<p>cd utils<\/p>\n<p>9. type sudo .\/install_server.sh\u00a0 (that will install binaries in \/usr\/local\/bin and add startup scripts), accept defaults (this process starts redis, use defaults for all settings for redis port, redis config file, redis log file, and data directory)<\/p>\n<p>Example defaults:<\/p>\n<p>Selected config:<br \/>\nPort : 6379<br \/>\nConfig file : \/etc\/redis\/6379.conf<br \/>\nLog file : \/var\/log\/redis_6379.log<br \/>\nData dir : \/var\/lib\/redis\/6379<br \/>\nExecutable : \/usr\/local\/bin\/redis-server<br \/>\nCli Executable : \/usr\/local\/bin\/redis-cli<\/p>\n<p>10. Confirm Redis is running:\u00a0ps -ef | grep &#8216;redis-server&#8217;<\/p>\n<p>11. quick test of redis:<\/p>\n<p>a. type redis-cli<\/p>\n<p>1. \u00a0prompt is 127.0.0.1:6379&gt;<\/p>\n<p>b. type ping<\/p>\n<p>2. response is PONG<\/p>\n<p>that should do it.<\/p>\n<h2 id=\"Redis-InstallanOlderVersionofRedis\"><span class=\"ez-toc-section\" id=\"Install_an_Older_Version_of_Redis\"><\/span>Install an Older Version of Redis<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are times when you need to install a previous version of Redis:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\r\nwget http:\/\/download.redis.io\/releases\/redis-2.8.21.tar.gz\r\ntar&amp;nbsp;xzf redis-2.8.21.tar.gz\r\ncd&amp;nbsp;redis-3.2.8\r\nsudo&amp;nbsp;make&amp;nbsp;MALLOC=libc\r\nsudo&amp;nbsp;make&amp;nbsp;install\r\nutil\r\n.\/install_server.sh\r\n\r\n<\/pre>\n<h1 id=\"Redis-Configuration\" class=\"auto-cursor-target\"><span class=\"ez-toc-section\" id=\"Configure_Redis\"><\/span>Configure Redis<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h2 id=\"Redis-RetrieveVersion\"><span class=\"ez-toc-section\" id=\"Retrieve_Version\"><\/span>Retrieve Version<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Run\u00a0redis-cli to enter the Redis command-line utility, and type INFO to retrieve information on the running Redis server.<\/p>\n<div class=\"code panel pdl conf-macro output-block\">\n<div class=\"codeContent panelContent pdl\">\n<div id=\"highlighter_647896\" class=\"syntaxhighlighter sh-confluence nogutter  bash\">redis-server &#8211;version<\/div>\n<\/div>\n<\/div>\n<h2 id=\"Redis-ConfigurationFile\"><span class=\"ez-toc-section\" id=\"Configuration_File\"><\/span>Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<div class=\"code panel pdl conf-macro output-block\">\n<div class=\"codeContent panelContent pdl\">\n<div id=\"highlighter_454758\" class=\"syntaxhighlighter sh-confluence nogutter  bash\">\/etc\/redis\/6379.conf<\/div>\n<\/div>\n<\/div>\n<h2 id=\"Redis-ChangeDefaultPort\"><span class=\"ez-toc-section\" id=\"Change_Default_Port\"><\/span>Change Default Port<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>Locate your redis.conf file (it will probably be at \/etc\/redis\/6379.conf).<\/li>\n<li>Copy the file or edit that one and change the port directive to any free port.<\/li>\n<li>Start Redis with the new config file (note that if you&#8217;ve copied the file in the previous step, you&#8217;ll need to change the service&#8217;s startup script to use that file).<\/li>\n<\/ol>\n<div class=\"toc-macro client-side-toc-macro  conf-macro output-block hidden-outline\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Redis is an open source, BSD licensed, advanced key-value cache and store. Redis is often referred to as a data structure server since keys can [&#8230;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-1171","page","type-page","status-publish","hentry"],"jetpack_shortlink":"https:\/\/wp.me\/P1BQ8S-iT","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.developerscloset.com\/index.php?rest_route=\/wp\/v2\/pages\/1171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.developerscloset.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.developerscloset.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.developerscloset.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.developerscloset.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1171"}],"version-history":[{"count":1,"href":"https:\/\/www.developerscloset.com\/index.php?rest_route=\/wp\/v2\/pages\/1171\/revisions"}],"predecessor-version":[{"id":1173,"href":"https:\/\/www.developerscloset.com\/index.php?rest_route=\/wp\/v2\/pages\/1171\/revisions\/1173"}],"wp:attachment":[{"href":"https:\/\/www.developerscloset.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}