{"id":201110,"date":"2025-05-10T08:15:52","date_gmt":"2025-05-10T00:15:52","guid":{"rendered":"https:\/\/server.hk\/cnblog\/201110\/"},"modified":"2025-05-10T08:15:52","modified_gmt":"2025-05-10T00:15:52","slug":"centos7%e4%b8%8bredis3-2-8%e6%9c%80%e6%96%b0%e7%89%88%e6%9c%ac%e5%ae%89%e8%a3%85%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/201110\/","title":{"rendered":"Centos7\u4e0bRedis3.2.8\u6700\u65b0\u7248\u672c\u5b89\u88c5\u6559\u7a0b"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>Centos7\u4e0bRedis3.2.8\u6700\u65b0\u7248\u672c\u5b89\u88c5\u6559\u7a0b<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u77e5\u8bc6\u70b9\u638c\u63e1\u4e86\uff0c\u8fd8\u9700\u8981\u4e0d\u65ad\u7ec3\u4e60\u624d\u80fd\u719f\u7ec3\u8fd0\u7528\u3002\u4e0b\u9762golang\u5b66\u4e60\u7f51\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u4e2a\u6570\u636e\u5e93\u5f00\u53d1\u5b9e\u6218\uff0c\u624b\u628a\u624b\u6559\u5927\u5bb6\u5b66\u4e60\u300aCentos7\u4e0bRedis3.2.8\u6700\u65b0\u7248\u672c\u5b89\u88c5\u6559\u7a0b\u300b\uff0c\u5728\u5b9e\u73b0\u529f\u80fd\u7684\u8fc7\u7a0b\u4e2d\u4e5f\u5e26\u5927\u5bb6\u91cd\u65b0\u6e29\u4e60\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6e29\u6545\u800c\u77e5\u65b0\uff0c\u56de\u5934\u770b\u770b\u8bf4\u4e0d\u5b9a\u53c8\u6709\u4e0d\u4e00\u6837\u7684\u611f\u609f\uff01<\/p>\n<p><strong>\u4e00\u3001\u7cfb\u7edf\u73af\u5883\u548c\u7248\u672c\u8bf4\u660e<\/strong><\/p>\n<p>\u7684\u7248\u672c\u9009\u53d6\u76ee\u524d\u7684\u5b98\u7f51\u7248\u672credis-3.2.8\u3002<\/p>\n<p><strong>\u4e8c\u3001Redis\u7684\u5b89\u88c5\u6b65\u9aa4<\/strong><\/p>\n<p>2.1\u5728\u7ebf\u4e0b\u8f7dRedis\u7684\u5b89\u88c5\u5305<\/p>\n<pre>\n[root@localhost lzh]# wget http:\/\/download.redis.io\/releases\/redis-3.2.8.tar.gz\n--2017-04-18 09:37:12-- http:\/\/download.redis.io\/releases\/redis-3.2.8.tar.gz\n\u6b63\u5728\u89e3\u6790\u4e3b\u673a download.redis.io (download.redis.io)... 109.74.203.151\n\u6b63\u5728\u8fde\u63a5 download.redis.io (download.redis.io)|109.74.203.151|:80... \u5df2\u8fde\u63a5\u3002\n\u5df2\u53d1\u51fa HTTP \u8bf7\u6c42\uff0c\u6b63\u5728\u7b49\u5f85\u56de\u5e94... 200 OK\n\u957f\u5ea6\uff1a1547237 (1.5M) [application\/x-gzip]\n\u6b63\u5728\u4fdd\u5b58\u81f3: \u201credis-3.2.8.tar.gz\u201d\n100%[=====================================================&gt;] 1,547,237 315KB\/s \u7528\u65f6 5.6s \n2017-04-18 09:37:20 (268 KB\/s) - \u5df2\u4fdd\u5b58 \u201credis-3.2.8.tar.gz\u201d [1547237\/1547237])\n\n<\/pre>\n<p>2.2 \u89e3\u538b\u4e0b\u8f7dRedis\u6e90\u7801\u538b\u7f29\u5305\uff0c\u751f\u6210\u65b0\u7684\u76ee\u5f55redis-3.2.8<\/p>\n<p><span style=\"color: #800000\">$ tar xzf redis-3.2.8.tar.gz<\/span><\/p>\n<p>2.3\u8fdb\u5165\u76ee\u5f55,\u6267\u884cmake\u7f16\u8bd1<\/p>\n<p><span style=\"color: #800000\">$ cd redis-3.2.8<\/span><\/p>\n<p><span style=\"color: #800000\">$ make <br \/><\/span><\/p>\n<p>\u9700\u8981\u4e00\u6bb5\u65f6\u95f4\u7f16\u8bd1\uff0c\u76f4\u5230\u770b\u5230<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20221229\/167231702063ad885cb13b9.png\" class=\"aligncenter\">[\/code]<\/p>\n<p>\u6ce8\u610f\uff1amake\u547d\u4ee4\u6267\u884c\u5b8c\u6210\u7f16\u8bd1\u540e\uff0c\u4f1a\u5728src\u76ee\u5f55\u4e0b\u751f\u62106\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5206\u522b\u662f<\/p>\n<p>redis-server\u3001redis-cli\u3001redis-benchmark\u3001redis-check-aof\u3001redis-check-rdb\u3001redis-sentinel\u3002<\/p>\n<p>\u65b0\u7248\u672credis-check-dump\u6539\u6210redis-check-rdb<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20221229\/167231702163ad885d549ea.png\" class=\"aligncenter\"><\/p>\n<p><strong>\u4e09\u3001Redis\u5b89\u88c5\u914d\u7f6e<\/strong><\/p>\n<p>3.1 \u5b89\u88c5Redis\uff0c\u6267\u884cmake install\u3002\u4f1a\u5c06make\u7f16\u8bd1\u751f\u6210\u76846\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u62f7\u8d1d\u5230\/usr\/local\/bin\u76ee\u5f55\u4e0b\uff1b<\/p>\n<pre>\n[root@localhost redis-3.2.8]# make install\ncd src &amp;&amp; make install\nmake[1]: \u8fdb\u5165\u76ee\u5f55\u201c\/home\/lzh\/redis-3.2.8\/src\u201d\nHint: It's a good idea to run 'make test' ;)\n INSTALL install\n INSTALL install\n INSTALL install\n INSTALL install\n INSTALL install\nmake[1]: \u79bb\u5f00\u76ee\u5f55\u201c\/home\/lzh\/redis-3.2.8\/src\u201d\n\n<\/pre>\n<p>3.2 \u6267\u884c.\/utils\/install_server.sh\u914d\u7f6eRedis\u914d\u7f6e\u4e4b\u540eRedis\u80fd\u968f\u7cfb\u7edf\u542f\u52a8\u3002\u6267\u884c\u671f\u95f4\u4f1a\u8ba9\u4f60\u9009\u62e9\u7aef\u53e3\uff0c\u6587\u4ef6\u540d\u79f0\u7b49\uff0c\u6211\u90fd\u9009\u9ed8\u8ba4\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20221229\/167231702163ad885da3efb.png\" class=\"aligncenter\"><\/p>\n<p>3.3 \u67e5\u770b\u5f00\u673a\u542f\u52a8\u5217\u8868<\/p>\n<pre>\n[root@localhost redis-3.2.8]# chkconfig --list\n\u6ce8\u610f\uff1a\u8be5\u8f93\u51fa\u7ed3\u679c\u53ea\u663e\u793a SysV \u670d\u52a1\uff0c\u5e76\u4e0d\u5305\u542b\u539f\u751f systemd \u670d\u52a1\u3002SysV \u914d\u7f6e\u6570\u636e\u53ef\u80fd\u88ab\u539f\u751f systemd \u914d\u7f6e\u8986\u76d6\u3002 \n  \u5982\u679c\u60a8\u60f3\u5217\u51fa systemd \u670d\u52a1,\u8bf7\u6267\u884c 'systemctl list-unit-files'\u3002\n  \u6b32\u67e5\u770b\u5bf9\u7279\u5b9a target \u542f\u7528\u7684\u670d\u52a1\u8bf7\u6267\u884c\n  'systemctl list-dependencies [target]'\u3002\nnetconsole   0:\u5173 1:\u5173 2:\u5173 3:\u5173 4:\u5173 5:\u5173 6:\u5173\nnetwork   0:\u5173 1:\u5173 2:\u5f00 3:\u5f00 4:\u5f00 5:\u5f00 6:\u5173\nredis_6379   0:\u5173 1:\u5173 2:\u5f00 3:\u5f00 4:\u5f00 5:\u5f00 6:\u5173\n\n<\/pre>\n<p><strong>\u56db\u3001Redis\u670d\u52a1\u67e5\u770b\u3001\u5f00\u542f\u3001\u5173\u95ed<\/strong><\/p>\n<p>4.1\u901a\u8fc7ps -ef|grep redis\u547d\u4ee4\u67e5\u770bRedis\u8fdb\u7a0b<\/p>\n<pre>\n[root@localhost redis-3.2.8]# ps -ef|grep redis\nroot   12831   1 0 10:21 ?    00:00:01 \/usr\/local\/bin\/redis-server 127.0.0.1:6379\nroot   13100  4090 0 10:29 pts\/0  00:00:00 grep --color=auto redis<\/pre>\n<p>4.2 \u5173\u95edRedis\u670d\u52a1\u64cd\u4f5c\u901a\u8fc7\/etc\/init.d\/redis_6379 stop\u547d\u4ee4\uff0c\u4e5f\u53ef\u901a\u8fc7\uff08service redis_6379 stop\uff09<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20221229\/167231702363ad885fd6f73.png\" class=\"aligncenter\"><\/p>\n<p>4.3 \u5f00\u542fRedis\u670d\u52a1\u64cd\u4f5c\u901a\u8fc7\/etc\/init.d\/redis_6379 start\u547d\u4ee4\uff0c\u4e5f\u53ef\u901a\u8fc7\uff08service redis_6379 start\uff09<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20221229\/167231702563ad8861aec33.png\" class=\"aligncenter\"><\/p>\n<p>\u4e5f\u53ef\u4ee5\u7528redis-server\u547d\u4ee4\u542f\u52a8<\/p>\n<p><span style=\"color: #800000\">$ src\/redis-server<\/span><\/p>\n<p><strong>\u4e94\u3001Redis\u6d4b\u8bd5<\/strong><\/p>\n<pre>\n[root@localhost bin]# redis-cli\n127.0.0.1:6379&gt; flushdb --\u6e05\u7a7a\u5f53\u524d\u9009\u62e9\u7684\u6570\u636e\u5e93\nOK\n127.0.0.1:6379&gt; set testkey 2\nOK\n127.0.0.1:6379&gt; get testkey\n\"2\"<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Centos7\u4e0bRedis3.2&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-201110","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=201110"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201110\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=201110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=201110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=201110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}