{"id":135358,"date":"2019-02-01T09:29:19","date_gmt":"2019-02-01T01:29:19","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=135358"},"modified":"2019-01-30T09:31:37","modified_gmt":"2019-01-30T01:31:37","slug":"redis-install-peizhi","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/redis-install-peizhi.html","title":{"rendered":"Redis\u5b89\u88c5\u4e0e\u914d\u7f6e"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u4eca\u5929\u5728\u4f7f\u7528Redis\u7684\u65f6\u5019\u9047\u5230\u4e86\u4e00\u4e9b\u95ee\u9898\uff0c\u8fd9\u4e2a\u95ee\u9898\u7684\u89e3\u51b3\uff0c\u53d1\u73b0\u5f88\u591a\u4eba\u4f7f\u7528Redis\u7684\u65f6\u5019\u6ca1\u6709\u4e00\u70b9\u5b89\u5168\u610f\u8bc6\u3002\u6240\u4ee5\u53c8\u91cd\u6e29\u4e86\u4e00\u4e0bRedis\uff0c\u89c9\u5f97\u5e94\u8be5\u5199\u4e00\u4e0bRedis\u7684\u5b89\u5168\u548c\u914d\u7f6e\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u5b89\u88c5<\/strong><\/div>\n

\u4e0b\u8f7d\uff0c\u89e3\u538b\uff0c\u7f16\u8bd1:<\/p>\n

$<\/span> wget http:\/\/download.redis.io\/releases\/redis-4.0.10.tar.gz<\/span><\/span>\r\n$<\/span> tar xzf redis-4.0.10.tar.gz<\/span><\/span>\r\n$<\/span> mv redis-4.0.10 \/usr\/local<\/span>\/redis<\/span><\/span>\r\n$<\/span> cd<\/span> \/usr\/local<\/span>\/redis<\/span><\/span>\r\n$<\/span> make<\/span><\/span>\r\n<\/pre>\n

\u4e8c\u8fdb\u5236\u6587\u4ef6\u662f\u7f16\u8bd1\u5b8c\u6210\u540e\u5728src\u76ee\u5f55\u4e0b<\/p>\n

$<\/span> ll -a src | grep redis<\/span><\/span>\r\n-rw-rw-r-- 1 root root 2.4K Jun 13 19:02 redisassert.h<\/span>\r\n-rwxr-xr-x 1 root root 2.6M Sep 14 12:05 redis-benchmark<\/span>\r\n-rw-rw-r-- 1 root root  29K Jun 13 19:02 redis-benchmark.c<\/span>\r\n-rw-r--r-- 1 root root 129K Sep 14 12:05 redis-benchmark.o<\/span>\r\n-rwxr-xr-x 1 root root 6.0M Sep 14 12:05 redis-check-aof<\/span>\r\n-rw-rw-r-- 1 root root 7.0K Jun 13 19:02 redis-check-aof.c<\/span>\r\n-rw-r--r-- 1 root root  38K Sep 14 12:05 redis-check-aof.o<\/span>\r\n-rwxr-xr-x 1 root root 6.0M Sep 14 12:05 redis-check-rdb<\/span>\r\n-rw-rw-r-- 1 root root  14K Jun 13 19:02 redis-check-rdb.c<\/span>\r\n-rw-r--r-- 1 root root  68K Sep 14 12:04 redis-check-rdb.o<\/span>\r\n-rwxr-xr-x 1 root root 2.8M Sep 14 12:05 redis-cli<\/span>\r\n-rw-rw-r-- 1 root root  99K Jun 13 19:02 redis-cli.c<\/span>\r\n-rw-r--r-- 1 root root 450K Sep 14 12:05 redis-cli.o<\/span>\r\n-rw-rw-r-- 1 root root  22K Jun 13 19:02 redismodule.h<\/span>\r\n-rwxr-xr-x 1 root root 6.0M Sep 14 12:05 redis-sentinel<\/span>\r\n-rwxr-xr-x 1 root root 6.0M Sep 14 12:05 redis-server<\/span>\r\n-rwxrwxr-x 1 root root  65K Jun 13 19:02 redis-trib<\/span>\r\n\r\n<\/pre>\n
\n

\u5176\u4e2dredis-server\u4e3a\u670d\u52a1\u7aef\u7a0b\u5e8f\uff0credis-cli\u4e3a\u5ba2\u6237\u7aef\u7a0b\u5e8f\u3002<\/p>\n<\/div>\n

\u521b\u5efa\u670d\u52a1<\/strong><\/div>\n

\u4e8c\u8fdb\u5236\u6587\u4ef6\u662f\u7f16\u8bd1\u5b8c\u6210\u540e\u5728src\u76ee\u5f55\u4e0b\uff0c\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u542f\u52a8Redis\u670d\u52a1\uff1a<\/p>\n

$<\/span> ln -s \/usr\/local<\/span>\/redis\/src\/redis-cli \/usr\/bin\/redis<\/span><\/span>\r\n$<\/span> ln -s \/usr\/local<\/span>\/redis\/src\/redis-server \/usr\/bin\/redisd<\/span><\/span>\r\n\r\n<\/pre>\n
\u8f93\u51fa\u7248\u672c<\/strong><\/span><\/div>\n
$ redis --version\r\nredis-cli 4.0.10\r\n$ redisd --version\r\nRedis server v=4.0.10 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=e53a76b77e60d5b0\r\n<\/pre>\n

\u81f3\u6b64\uff0c\u8868\u660e\u4f60\u7684redis\u5df2\u7ecf\u5b89\u88c5\u5b8c\u6bd5\u3002<\/p>\n

\u914d\u7f6e<\/strong><\/div>\n

\u4e3a\u4ec0\u4e48\u914d\u7f6e\u8981\u5355\u72ec\u5217\u51fa\u6765\u4e00\u4e2a\u6807\u9898\u5462\uff1f<\/p>\n

\u8fd9\u662f\u56e0\u4e3aRedis\u5e76\u6ca1\u6709\u6700\u5927\u5730\u53bb\u4f18\u5316\u5b89\u5168\u65b9\u9762\uff0c\u800c\u662f\u5c3d\u6700\u5927\u53ef\u80fd\u53bb\u4f18\u5316\u9ad8\u6027\u80fd\u548c\u6613\u7528\u6027\u3002<\/p>\n

Redis\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u5f00\u542f6379\u7aef\u53e3\uff0c\u5728\u8ba4\u8bc1\u672a\u5f00\u542f\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u5bfc\u81f4\u4efb\u610f\u7528\u6237\u8fdb\u884c\u672a\u6388\u6743\u8bbf\u95ee\u64cd\u4f5c\u3002
\n\u6240\u4ee5\u6211\u4eec\u8fd9\u91cc\u9700\u8981\u505a\u4e00\u4e9b\u5b89\u5168\u6027\u914d\u7f6e<\/p>\n

\n

\u65b0\u589e\u7528\u6237<\/strong><\/span><\/div>\n<\/p>\n

\u5343\u4e07\u4e0d\u8981\u7528\u4e00\u4e2a\u6709\u8f83\u9ad8\u6743\u9650\u7684\u7528\u6237\u6765\u542f\u52a8Redis\u3002\u5982\u679c\u4f60\u7684Reidis\u4e0d\u5b89\u5168\uff0c\u90a3\u4e48\u4f60\u7684\u9ad8\u6743\u9650\u7528\u6237\u5c06\u4f1a\u6210\u4e3a\u7a81\u7834\u53e3\uff0c\u5bfc\u81f4\u4f60\u7684\u670d\u52a1\u5668\u88ab\u653b\u51fb\u3002<\/p>\n

\u6240\u4ee5\u6211\u4eec\u9700\u8981\u521b\u5efaredis\u8d26\u6237\uff0c\u5e76\u901a\u8fc7\u8be5\u8d26\u6237\u542f\u52a8redis\u670d\u52a1\uff0c\u5e76\u4e14\u914d\u7f6e\u8be5\u8d26\u6237\u7981\u6b62\u767b\u9646\u3002<\/p>\n

$<\/span> adduser redis<\/span><\/span>\r\n$<\/span> vim \/etc\/passwd<\/span><\/span>\r\nredis:x:1001:1001:,,,:\/home\/redis:\/usr\/sbin\/nologin<\/span>\r\n$<\/span> chown -R redis:redis \/usr\/local<\/span>\/redis<\/span><\/span>\r\n\r\n<\/pre>\n

\n

\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/strong><\/span><\/div>\n<\/p>\n

\u8fd9\u91cc\u9700\u8981\u4f60\u5bf9vim\u6709\u57fa\u672c\u7684\u64cd\u4f5c<\/p>\n

$<\/span> vim redis.conf<\/span><\/span>\r\n#<\/span> \u7b2c92\u884c\u5de6\u53f3   \u4fee\u6539\u7aef\u53e3<\/span><\/span>\r\nport 7379<\/span>\r\n#<\/span> \u7b2c171\u884c\u5de6\u53f3  \u65e5\u5fd7\u6587\u4ef6<\/span><\/span>\r\nlogfile \/var\/log\/redis\/redis.log<\/span>\r\n#<\/span> \u7b2c263\u884c\u5de6\u53f3  \u8bbe\u7f6e\u5feb\u7167\u6587\u4ef6\u76ee\u5f55\uff0c\u5207\u52ff\u8bbe\u7f6e\u6210\u4e00\u4e2aredis\u7528\u6237\u6ca1\u6709\u6743\u9650\u7684\u76ee\u5f55<\/span><\/span>\r\ndir \/usr\/local\/redis\/<\/span>\r\n#<\/span> \u7b2c500\u884c\u5de6\u53f3  \u8bbe\u7f6e\u5bc6\u7801<\/span><\/span>\r\nrequirepass YOUR_PASSWORD<\/span>\r\n$<\/span> mkdir \/var\/log<\/span>\/redis<\/span><\/span>\r\n$<\/span> chown -R redis:redis \/var\/log<\/span>\/redis\/<\/span><\/span>\r\n\r\n\r\n<\/pre>\n
\u914d\u7f6e\u4e00\u4e2a\u542f\u52a8\u7a0b\u5e8f<\/strong><\/div>\n

redis-server\u9ed8\u8ba4\u4e0d\u662f\u540e\u53f0\u7a0b\u5e8f\u542f\u52a8\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u4e3a\u5b83\u914d\u7f6e\u4e00\u4e2a\u542f\u52a8\u7a0b\u5e8f
\n.<\/p>\n

$ vim \/usr\/bin\/goredisd\r\nnohup \/usr\/bin\/redisd \/usr\/local\/redis\/redis.conf >> \/var\/log\/redis\/goredisd.log 2>&1 &\r\n$ goredisd\r\n$ ps -axu | grep redis\r\nredis 19498 0.0 0.1 145304 2580 pts\/0 Sl 10:49 0:09 \/usr\/bin\/redisd *:7379\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u4e0b\u8f7d\uff0c\u89e3\u538b\uff0c\u7f16\u8bd1: $ wget http:\/\/download.redis.io\/releases\/redi […]<\/p>\n","protected":false},"author":362,"featured_media":135425,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-135358","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/135358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=135358"}],"version-history":[{"count":15,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/135358\/revisions"}],"predecessor-version":[{"id":135488,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/135358\/revisions\/135488"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/135425"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=135358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=135358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=135358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}