{"id":6021,"date":"2024-11-14T08:08:22","date_gmt":"2024-11-14T00:08:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6021\/"},"modified":"2024-11-14T08:08:22","modified_gmt":"2024-11-14T00:08:22","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8bredis%e9%9b%86%e7%be%a4%e7%8a%b6%e6%80%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6021\/","title":{"rendered":"\u5982\u4f55\u67e5\u770bredis\u96c6\u7fa4\u72b6\u6001"},"content":{"rendered":"<p><strong>\u5982\u4f55\u67e5\u770b  \u96c6\u7fa4\u72b6\u6001<\/strong><\/p>\n<p>Redis \u96c6\u7fa4\u63d0\u4f9b\u4e86\u4e00\u79cd\u7ba1\u7406\u5206\u5e03\u5f0f Redis \u5b9e\u4f8b\u7684\u65b9\u6cd5\uff0c\u786e\u4fdd\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u6269\u5c55\u6027\u3002\u8981\u67e5\u770b\u96c6\u7fa4\u7684\u72b6\u6001\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u8fde\u63a5\u5230\u96c6\u7fa4<\/strong><\/p>\n<p>\u4f7f\u7528 redis-cli \u5de5\u5177\u8fde\u63a5\u5230\u96c6\u7fa4\u7684\u4e00\u4e2a\u4e3b\u8282\u70b9\uff1a<\/p>\n<pre>redis-cli -c -h &lt;\u4e3b\u8282\u70b9 IP&gt; -p &lt;\u4e3b\u8282\u70b9\u7aef\u53e3&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u68c0\u67e5\u96c6\u7fa4\u72b6\u6001<\/strong><\/p>\n<p>\u6267\u884c CLUSTER INFO \u547d\u4ee4\uff1a<\/p>\n<pre>CLUSTER INFO<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u7406\u89e3\u8f93\u51fa<\/strong><\/p>\n<p>\u8f93\u51fa\u5c06\u63d0\u4f9b\u6709\u5173\u96c6\u7fa4\u72b6\u6001\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li> <strong>cluster_state\uff1a<\/strong>\u96c6\u7fa4\u7684\u5f53\u524d\u72b6\u6001\uff0c\u4f8b\u5982 active\u3001failover\u3001disconnected \u7b49\u3002<\/li>\n<li> <strong>cluster_slots\uff1a<\/strong>\u5df2\u5206\u914d\u5230\u96c6\u7fa4\u8282\u70b9\u7684 16384 \u4e2a\u63d2\u69fd\u3002<\/li>\n<li> <strong>cluster_nodes\uff1a<\/strong>\u96c6\u7fa4\u4e2d\u6240\u6709\u8282\u70b9\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u5176 IP\u3001\u7aef\u53e3\u3001\u89d2\u8272\u548c\u72b6\u6001\u3002<\/li>\n<li> <strong>cluster_current_epoch\uff1a<\/strong>\u96c6\u7fa4\u7684\u5f53\u524d\u7eaa\u5143\uff0c\u7528\u4e8e\u786e\u5b9a\u4e3b\u8282\u70b9\u548c\u4ece\u8282\u70b9\u3002<\/li>\n<li> <strong>cluster_config_epoch\uff1a<\/strong>\u96c6\u7fa4\u914d\u7f6e\u7684\u7eaa\u5143\uff0c\u7528\u4e8e\u8ddf\u8e2a\u96c6\u7fa4\u5143\u6570\u636e\u7684\u66f4\u6539\u3002<\/li>\n<\/ul>\n<p><strong>4. \u68c0\u67e5\u8282\u70b9\u8be6\u7ec6\u4fe1\u606f<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u6709\u5173\u7279\u5b9a\u8282\u70b9\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u4f7f\u7528 CLUSTER NODES \u547d\u4ee4\uff0c\u540e\u8ddf\u8282\u70b9 ID\uff1a<\/p>\n<pre>CLUSTER NODES &lt;\u8282\u70b9 ID&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\u5c06\u63d0\u4f9b\u6709\u5173\u8be5\u8282\u70b9\u7684\u89d2\u8272\u3001\u72b6\u6001\u548c\u4e0e\u5176\u4ed6\u8282\u70b9\u7684\u8fde\u63a5\u4fe1\u606f\u3002<\/p>\n<p><strong>5. \u68c0\u67e5\u63d2\u69fd\u5206\u914d<\/strong><\/p>\n<p>\u8981\u67e5\u770b\u63d2\u69fd\u5982\u4f55\u5206\u914d\u7ed9\u96c6\u7fa4\u8282\u70b9\uff0c\u8bf7\u4f7f\u7528 CLUSTER SLOTS \u547d\u4ee4\uff1a<\/p>\n<pre>CLUSTER SLOTS<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u51fa\u5c06\u663e\u793a\u6bcf\u4e2a\u63d2\u69fd\u7684\u6240\u6709\u8005\u8282\u70b9\u548c\u5907\u4efd\u8282\u70b9\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u67e5\u770b\u96c6\u7fa4\u72b6\u6001\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>\u5982\u4f55\u67e5\u770b \u96c6\u7fa4\u72b6\u6001 Redis \u96c6\u7fa4\u63d0\u4f9b\u4e86\u4e00\u79cd\u7ba1\u7406\u5206\u5e03\u5f0f Redis \u5b9e\u4f8b\u7684\u65b9\u6cd5\uff0c\u786e\u4fdd\u9ad8\u53ef\u7528\u6027\u548c\u53ef\u6269\u5c55\u6027\u3002\u8981\u67e5\u770b\u96c6\u7fa4\u7684\u72b6\u6001\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u8fde\u63a5\u5230\u96c6\u7fa4 \u4f7f\u7528 redis-cli \u5de5\u5177\u8fde\u63a5\u5230\u96c6\u7fa4\u7684\u4e00\u4e2a\u4e3b\u8282\u70b9\uff1a redis-cli -c -h &lt;\u4e3b\u8282\u70b9 IP&gt; -p &lt;\u4e3b\u8282\u70b9\u7aef\u53e3&gt; \u767b\u5f55\u540e\u590d\u5236 2. \u68c0\u67e5\u96c6\u7fa4\u72b6\u6001 \u6267\u884c CLUSTER INFO \u547d\u4ee4\uff1a CLUSTER INFO \u767b\u5f55\u540e\u590d\u5236 3. \u7406\u89e3\u8f93\u51fa \u8f93\u51fa\u5c06\u63d0\u4f9b\u6709\u5173\u96c6\u7fa4\u72b6\u6001\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\uff1a cluster_state\uff1a\u96c6\u7fa4\u7684\u5f53\u524d\u72b6\u6001\uff0c\u4f8b\u5982 active\u3001failover\u3001disconnected \u7b49\u3002 cluster_slots\uff1a\u5df2\u5206\u914d\u5230\u96c6\u7fa4\u8282\u70b9\u7684 16384 \u4e2a\u63d2\u69fd\u3002 cluster_nodes\uff1a\u96c6\u7fa4\u4e2d\u6240\u6709\u8282\u70b9\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u5176 IP\u3001\u7aef\u53e3\u3001\u89d2\u8272\u548c\u72b6\u6001\u3002 cluster_current_epoch\uff1a\u96c6\u7fa4\u7684\u5f53\u524d\u7eaa\u5143\uff0c\u7528\u4e8e\u786e\u5b9a\u4e3b\u8282\u70b9\u548c\u4ece\u8282\u70b9\u3002 cluster_config_epoch\uff1a\u96c6\u7fa4\u914d\u7f6e\u7684\u7eaa\u5143\uff0c\u7528\u4e8e\u8ddf\u8e2a\u96c6\u7fa4\u5143\u6570\u636e\u7684\u66f4\u6539\u3002 4. \u68c0\u67e5\u8282\u70b9\u8be6\u7ec6\u4fe1\u606f \u8981\u67e5\u770b\u6709\u5173\u7279\u5b9a\u8282\u70b9\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u4f7f\u7528 CLUSTER NODES \u547d\u4ee4\uff0c\u540e\u8ddf\u8282\u70b9 ID\uff1a CLUSTER NODES &lt;\u8282\u70b9 ID&gt; \u767b\u5f55\u540e\u590d\u5236 \u8f93\u51fa\u5c06\u63d0\u4f9b\u6709\u5173\u8be5\u8282\u70b9\u7684\u89d2\u8272\u3001\u72b6\u6001\u548c\u4e0e\u5176\u4ed6\u8282\u70b9\u7684\u8fde\u63a5\u4fe1\u606f\u3002 5. [&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-6021","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6021","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=6021"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6021\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}