{"id":5207,"date":"2021-10-20T13:03:08","date_gmt":"2021-10-20T05:03:08","guid":{"rendered":"http:\/\/blog.ywdevops.cn\/?p=5207"},"modified":"2024-09-04T11:58:40","modified_gmt":"2024-09-04T03:58:40","slug":"redis-2","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2021\/10\/20\/redis-2\/","title":{"rendered":"redis\u5355\u673a\u7f16\u8bd1\u5b89\u88c5"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u672c\u4f8b\u5b50\u4ee5redis-5.0.14\u4e3a\u4f8b\u5b50\u8fdb\u884c\u90e8\u7f72<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5305\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"http:\/\/download.redis.io\/releases\/\" target=\"_blank\" rel=\"noreferrer noopener\">redis\u4e0b\u8f7d\u5730\u5740<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;download.redis.io\/releases\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u9996\u5148\u5c06redis\u5b89\u88c5\u5305\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u5e76\u6267\u884c\u547d\u4ee4\u89e3\u538b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u4e0a\u4f20\u5b89\u88c5\u5305\nmkdir -p \/usr\/local\/redis &amp;&amp; cd \/usr\/local\/redis\nrz redis-5.0.14.tar.gz\n#\u89e3\u538b\u7f29\ntar xf redis-5.0.14.tar.gz<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u8fdb\u5165\u5230\u89e3\u538b\u540e\u7684\u76ee\u5f55\uff0c\u7136\u540e\u6267\u884cmake\u8fdb\u884c\u7f16\u8bd1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u8fdb\u5165\u8def\u5f84\ncd redis-5.0.14\n#\u6267\u884c\u547d\u4ee4make\u8fdb\u884c\u7f16\u8bd1\nmake\n\n#\u6ce8\u610f\uff1a\u5982\u679c\u63d0\u793a\u9519\u8bef\u4fe1\u606fzmalloc.h:50:31: fatal error: jemalloc\/jemalloc.h: No such file or directory\uff0c\u90a3\u4e48\u53ef\u4ee5\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u8fdb\u884c\u7f16\u8bd1\nmake MALLOC=libc<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u8fdb\u5165src\u8def\u5f84\uff0c\u6267\u884c\u547d\u4ee4make install \u5b89\u88c5redis\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u8fdb\u5165\u8def\u5f84 redis-5.0.14\/src\uff0c\u6267\u884c\u547d\u4ee4\u5b89\u88c5redis\nmake install<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"608\" height=\"194\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/6-2.png\" alt=\"\" class=\"wp-image-5208\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/6-2.png 608w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/6-2-300x96.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/6-2-600x191.png 600w\" sizes=\"auto, (max-width: 608px) 100vw, 608px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u5b89\u88c5\u5b8c\u6210\u5728src\u8def\u5f84\u4e0b\u53ef\u4ee5\u770b\u5230redis-server\u3001redis-cli\u7b49\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"222\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/7-2.png\" alt=\"\" class=\"wp-image-5210\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/7-2.png 544w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2021\/10\/7-2-300x122.png 300w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u6700\u540e\u6267\u884c\u547d\u4ee4\u542f\u52a8reids\u5373\u53ef\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u8fdb\u5165src\u76ee\u5f55\uff0c\u6267\u884c\u547d\u4ee4\u542f\u52a8redis\ncd redis-5.0.14\/src\nnohup .\/redis-server ..\/redis.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u9644\u52a0\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5c06redis\u6253\u6210Linux\u670d\u52a1\u6587\u4ef6\uff0c\u968f\u7740\u673a\u5668\u542f\u52a8\u53ef\u4ee5\u5b9e\u73b0\u81ea\u542f\uff0c\u7f16\u8f91\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/lib\/systemd\/system\/redis.conf\n#\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1aredis-server\u548credis.conf\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u66ff\u6362\u5373\u53ef\n&#91;Unit]\nDescription=redis\nAfter=network.target remote-fs.target nss-lookup.target\n&#91;Service]\nType=simple\nExecStart=\/root\/redis\/src\/redis-server \/root\/redis\/redis.conf\nExecStop=\/root\/redis\/src\/redis-cli shutdown\nGroup=root\nUser=root\n&#91;Install]\nWantedBy=multi-user.target\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7systemctl   start\/stop  redis\u5b9e\u73b0\u542f\u52a8\u505c\u6b62<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fde\u63a5redis\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong> redis-cli -h host -p port -a password <\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">redis\u7684\u5e38\u75285\u79cd\u7c7b\u578b\u3002redis\u7684key\u53ea\u80fd\u662f\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u800cvalue\u5374\u53ef\u4ee5\u6709\u5f88\u591a\u79cd\u7c7b\u578b\u3002value\u7c7b\u578b\u53ef\u4ee5\u4e3astring\u3001set\u3001sortset\u3001list\u3001<a rel=\"noreferrer noopener\" href=\"https:\/\/so.csdn.net\/so\/search?q=hash&amp;spm=1001.2101.3001.7020\" target=\"_blank\">hash<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u4f8b\u5b50\u4ee5redis-5.0.14\u4e3a\u4f8b\u5b50\u8fdb\u884c\u90e8\u7f72 \u5305\u4e0b\u8f7d\u5730\u5740\uff1aredis\u4e0b\u8f7d\u5730\u5740 1\u3001\u9996\u5148\u5c06redis\u5b89\u88c5\u5305\u4e0a\u4f20 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":5212,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,25],"tags":[],"class_list":["post-5207","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-redis","category-database"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=5207"}],"version-history":[{"count":10,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5207\/revisions"}],"predecessor-version":[{"id":17577,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/5207\/revisions\/17577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/5212"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=5207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=5207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=5207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}