{"id":5103,"date":"2024-11-14T12:36:56","date_gmt":"2024-11-14T04:36:56","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5103\/"},"modified":"2024-11-14T12:36:56","modified_gmt":"2024-11-14T04:36:56","slug":"redis%e5%91%bd%e4%bb%a4%e8%a1%8c%e6%80%8e%e4%b9%88%e7%94%a8","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5103\/","title":{"rendered":"redis\u547d\u4ee4\u884c\u600e\u4e48\u7528"},"content":{"rendered":"<blockquote><p>\n  \u4f7f\u7528 redis \u547d\u4ee4\u884c\u5de5\u5177 (redis-cli) \u53ef\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u7ba1\u7406\u548c\u64cd\u4f5c redis\uff1a\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff0c\u6307\u5b9a\u5730\u5740\u548c\u7aef\u53e3\u3002\u4f7f\u7528\u547d\u4ee4\u540d\u79f0\u548c\u53c2\u6570\u5411\u670d\u52a1\u5668\u53d1\u9001\u547d\u4ee4\u3002\u4f7f\u7528 help \u547d\u4ee4\u67e5\u770b\u7279\u5b9a\u547d\u4ee4\u7684\u5e2e\u52a9\u4fe1\u606f\u3002\u4f7f\u7528 quit \u547d\u4ee4\u9000\u51fa\u547d\u4ee4\u884c\u5de5\u5177\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/21\/2024052116331970786.jpg\" class=\"aligncenter\" title=\"redis\u547d\u4ee4\u884c\u600e\u4e48\u7528\u63d2\u56fe\" alt=\"redis\u547d\u4ee4\u884c\u600e\u4e48\u7528\u63d2\u56fe\" \/><\/p>\n<p><strong>Redis \u547d\u4ee4\u884c\u7528\u6cd5<\/strong><\/p>\n<p>\u4f7f\u7528 Redis \u547d\u4ee4\u884c\u5de5\u5177\uff08-cli\uff09\u7ba1\u7406\u548c\u64cd\u4f5c Redis \u6570\u636e\u5e93\u975e\u5e38\u65b9\u4fbf\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528\u5b83\uff1a<\/p>\n<p><strong>1. \u8fde\u63a5\u5230 Redis \u670d\u52a1\u5668<\/strong><\/p>\n<pre>redis-cli -h &lt;\u4e3b\u673a\u5730\u5740&gt; -p &lt;\u7aef\u53e3\u53f7&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u4f7f\u7528\u9ed8\u8ba4\u5730\u5740\u548c\u7aef\u53e3\u8fde\u63a5\uff1aredis-cli<\/li>\n<li>\u6307\u5b9a\u81ea\u5b9a\u4e49\u5730\u5740\u548c\u7aef\u53e3\uff1aredis-cli -h 127.0.0.1 -p 6379<\/li>\n<\/ul>\n<p><strong>2. \u5411 Redis \u670d\u52a1\u5668\u53d1\u9001\u547d\u4ee4<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u53d1\u9001\u547d\u4ee4\uff1a<\/p>\n<pre>&lt;\u547d\u4ee4\u540d\u79f0&gt; &lt;\u53c2\u6570&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u83b7\u53d6\u7279\u5b9a\u952e\u7684\u503c\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>GET &lt;\u952e\u540d&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u67e5\u770b\u547d\u4ee4\u5e2e\u52a9<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u7279\u5b9a\u547d\u4ee4\u7684\u5e2e\u52a9\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a<\/p>\n<pre>HELP &lt;\u547d\u4ee4\u540d\u79f0&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8981\u67e5\u770b SET \u547d\u4ee4\u7684\u5e2e\u52a9\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>HELP SET<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u9000\u51fa\u547d\u4ee4\u884c\u5de5\u5177<\/strong><\/p>\n<p>\u8981\u9000\u51fa\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u8bf7\u4f7f\u7528 QUIT \u547d\u4ee4\uff1a<\/p>\n<pre>QUIT<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f7f\u7528 Redis \u547d\u4ee4\u884c\u5de5\u5177\u7684\u793a\u4f8b\uff1a<\/p>\n<ul>\n<li>\u521b\u5efa\u4e00\u4e2a\u65b0\u952e\uff1aSET mykey myvalue<\/li>\n<li>\u83b7\u53d6\u952e\u7684\u503c\uff1aGET mykey<\/li>\n<li>\u5220\u9664\u952e\uff1aDEL mykey<\/li>\n<li>\u67e5\u770b\u6240\u6709\u952e\uff1aKEYS *<\/li>\n<li>\u5237\u65b0\u6570\u636e\u5e93\uff1aFLUSHALL<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u547d\u4ee4\u884c\u600e\u4e48\u7528\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 redis \u547d\u4ee4\u884c\u5de5\u5177 (redis-cli) \u53ef\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u7ba1\u7406\u548c\u64cd\u4f5c redis\uff1a\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff0c\u6307\u5b9a\u5730\u5740\u548c\u7aef\u53e3\u3002\u4f7f\u7528\u547d\u4ee4\u540d\u79f0\u548c\u53c2\u6570\u5411\u670d\u52a1\u5668\u53d1\u9001\u547d\u4ee4\u3002\u4f7f\u7528 help \u547d\u4ee4\u67e5\u770b\u7279\u5b9a\u547d\u4ee4\u7684\u5e2e\u52a9\u4fe1\u606f\u3002\u4f7f\u7528 quit \u547d\u4ee4\u9000\u51fa\u547d\u4ee4\u884c\u5de5\u5177\u3002 Redis \u547d\u4ee4\u884c\u7528\u6cd5 \u4f7f\u7528 Redis \u547d\u4ee4\u884c\u5de5\u5177\uff08-cli\uff09\u7ba1\u7406\u548c\u64cd\u4f5c Redis \u6570\u636e\u5e93\u975e\u5e38\u65b9\u4fbf\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528\u5b83\uff1a 1. \u8fde\u63a5\u5230 Redis \u670d\u52a1\u5668 redis-cli -h &lt;\u4e3b\u673a\u5730\u5740&gt; -p &lt;\u7aef\u53e3\u53f7&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f7f\u7528\u9ed8\u8ba4\u5730\u5740\u548c\u7aef\u53e3\u8fde\u63a5\uff1aredis-cli \u6307\u5b9a\u81ea\u5b9a\u4e49\u5730\u5740\u548c\u7aef\u53e3\uff1aredis-cli -h 127.0.0.1 -p 6379 2. \u5411 Redis \u670d\u52a1\u5668\u53d1\u9001\u547d\u4ee4 \u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u53d1\u9001\u547d\u4ee4\uff1a &lt;\u547d\u4ee4\u540d\u79f0&gt; &lt;\u53c2\u6570&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u83b7\u53d6\u7279\u5b9a\u952e\u7684\u503c\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a GET &lt;\u952e\u540d&gt; \u767b\u5f55\u540e\u590d\u5236 3. \u67e5\u770b\u547d\u4ee4\u5e2e\u52a9 \u8981\u67e5\u770b\u7279\u5b9a\u547d\u4ee4\u7684\u5e2e\u52a9\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a HELP &lt;\u547d\u4ee4\u540d\u79f0&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u8981\u67e5\u770b SET \u547d\u4ee4\u7684\u5e2e\u52a9\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a HELP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5103","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5103"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5103\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}