{"id":6443,"date":"2024-08-06T20:44:30","date_gmt":"2024-08-06T12:44:30","guid":{"rendered":"https:\/\/t.n-years.com\/?p=6443"},"modified":"2024-08-06T20:44:30","modified_gmt":"2024-08-06T12:44:30","slug":"etcd-%e4%bb%8b%e7%bb%8d%ef%bc%8c%e4%bb%a5%e5%8f%8a%e5%92%8c-redis-%e7%9a%84%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=6443","title":{"rendered":"etcd \u4ecb\u7ecd\uff0c\u4ee5\u53ca\u548c redis \u7684\u533a\u522b"},"content":{"rendered":"<h3><strong>etcd \u4ecb\u7ecd<\/strong><\/h3>\n<p><strong>etcd<\/strong> \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u952e\u503c\u5b58\u50a8\u7cfb\u7edf\uff0c\u4e3b\u8981\u7528\u4e8e\u5b58\u50a8\u548c\u7ba1\u7406\u914d\u7f6e\u6570\u636e\u3001\u670d\u52a1\u53d1\u73b0\u548c\u534f\u8c03\u5de5\u4f5c\u3002\u5b83\u662f\u7531 CoreOS \u5f00\u53d1\u5e76\u88ab Cloud Native Computing Foundation (CNCF) \u6258\u7ba1\u3002etcd \u662f Kubernetes\u3001Consul \u7b49\u73b0\u4ee3\u4e91\u539f\u751f\u7cfb\u7edf\u7684\u6838\u5fc3\u7ec4\u4ef6\u4e4b\u4e00\u3002<\/p>\n<h4><strong>\u4e3b\u8981\u7279\u70b9\u548c\u529f\u80fd<\/strong><\/h4>\n<ol>\n<li>\n<p><strong>\u5206\u5e03\u5f0f\u4e00\u81f4\u6027<\/strong>\uff1a<\/p>\n<ul>\n<li>etcd \u57fa\u4e8e Raft \u5171\u8bc6\u7b97\u6cd5\uff0c\u786e\u4fdd\u5728\u591a\u4e2a\u8282\u70b9\u4e4b\u95f4\u7684\u6570\u636e\u4e00\u81f4\u6027\uff0c\u5373\u4f7f\u5728\u51fa\u73b0\u7f51\u7edc\u5206\u533a\u6216\u8282\u70b9\u6545\u969c\u7684\u60c5\u51b5\u4e0b\u4e5f\u80fd\u4fdd\u6301\u4e00\u81f4\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9ad8\u53ef\u7528\u6027<\/strong>\uff1a<\/p>\n<ul>\n<li>\u901a\u8fc7\u590d\u5236\u6570\u636e\u5230\u591a\u4e2a\u8282\u70b9\u6765\u5b9e\u73b0\u9ad8\u53ef\u7528\u6027\uff0c\u8282\u70b9\u4e4b\u95f4\u53ef\u4ee5\u81ea\u52a8\u8fdb\u884c\u9009\u4e3e\u548c\u6545\u969c\u8f6c\u79fb\uff0c\u4fdd\u8bc1\u670d\u52a1\u7684\u6301\u7eed\u53ef\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5f3a\u4e00\u81f4\u6027<\/strong>\uff1a<\/p>\n<ul>\n<li>\u63d0\u4f9b\u5f3a\u4e00\u81f4\u6027\u7684\u8bfb\u5199\u64cd\u4f5c\uff0c\u786e\u4fdd\u6240\u6709\u5ba2\u6237\u7aef\u770b\u5230\u7684\u89c6\u56fe\u662f\u76f8\u540c\u7684\uff0c\u4e0d\u4f1a\u51fa\u73b0\u810f\u8bfb\u6216\u4e0d\u4e00\u81f4\u7684\u95ee\u9898\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u7b80\u6d01\u7684 API<\/strong>\uff1a<\/p>\n<ul>\n<li>\u63d0\u4f9b HTTP\/gRPC API \u7528\u4e8e\u64cd\u4f5c\u952e\u503c\u5bf9\uff0c\u5305\u62ec\u57fa\u672c\u7684 CRUD \u64cd\u4f5c\u3001\u4e8b\u52a1\u652f\u6301\u3001Watch\uff08\u76d1\u63a7\uff09\u7b49\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Watch \u529f\u80fd<\/strong>\uff1a<\/p>\n<ul>\n<li>\u652f\u6301\u5bf9\u952e\u503c\u5bf9\u7684\u53d8\u5316\u8fdb\u884c\u76d1\u63a7\uff0c\u5f53\u952e\u503c\u5bf9\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u5ba2\u6237\u7aef\u53ef\u4ee5\u63a5\u6536\u5230\u901a\u77e5\uff0c\u9002\u7528\u4e8e\u52a8\u6001\u914d\u7f6e\u548c\u670d\u52a1\u53d1\u73b0\u7b49\u573a\u666f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b89\u5168\u6027<\/strong>\uff1a<\/p>\n<ul>\n<li>\u652f\u6301\u57fa\u4e8e\u8bc1\u4e66\u7684 TLS \u52a0\u5bc6\uff0c\u4fdd\u8bc1\u6570\u636e\u5728\u4f20\u8f93\u8fc7\u7a0b\u4e2d\u7684\u5b89\u5168\u6027\uff0c\u540c\u65f6\u63d0\u4f9b\u7ec6\u7c92\u5ea6\u7684\u8bbf\u95ee\u63a7\u5236\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3><strong>Redis \u4ecb\u7ecd<\/strong><\/h3>\n<p><strong>Redis<\/strong> \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5185\u5b58\u6570\u636e\u7ed3\u6784\u5b58\u50a8\u7cfb\u7edf\uff0c\u652f\u6301\u591a\u79cd\u6570\u636e\u7ed3\u6784\u5982\u5b57\u7b26\u4e32\u3001\u54c8\u5e0c\u3001\u5217\u8868\u3001\u96c6\u5408\u7b49\uff0c\u901a\u5e38\u7528\u4f5c\u7f13\u5b58\u3001\u6d88\u606f\u961f\u5217\u6216\u6570\u636e\u5e93\u3002\u5b83\u5177\u6709\u6781\u9ad8\u7684\u6027\u80fd\u548c\u7075\u6d3b\u6027\u3002<\/p>\n<h4><strong>\u4e3b\u8981\u7279\u70b9\u548c\u529f\u80fd<\/strong><\/h4>\n<ol>\n<li>\n<p><strong>\u5185\u5b58\u5b58\u50a8<\/strong>\uff1a<\/p>\n<ul>\n<li>Redis \u4e3b\u8981\u5c06\u6570\u636e\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\uff0c\u4ee5\u5b9e\u73b0\u6781\u5feb\u7684\u8bfb\u5199\u901f\u5ea6\u3002\u5b83\u8fd8\u652f\u6301\u5c06\u6570\u636e\u6301\u4e45\u5316\u5230\u78c1\u76d8\u4ee5\u5b9e\u73b0\u6570\u636e\u6062\u590d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u4e30\u5bcc\u7684\u6570\u636e\u7ed3\u6784<\/strong>\uff1a<\/p>\n<ul>\n<li>\u652f\u6301\u591a\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u5305\u62ec\u5b57\u7b26\u4e32\u3001\u54c8\u5e0c\u3001\u5217\u8868\u3001\u96c6\u5408\u3001\u6709\u5e8f\u96c6\u5408\u7b49\uff0c\u63d0\u4f9b\u4e30\u5bcc\u7684\u64cd\u4f5c\u548c\u529f\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9ad8\u6027\u80fd<\/strong>\uff1a<\/p>\n<ul>\n<li>Redis \u63d0\u4f9b\u975e\u5e38\u9ad8\u7684\u8bfb\u5199\u541e\u5410\u91cf\u548c\u4f4e\u5ef6\u8fdf\uff0c\u9002\u7528\u4e8e\u9ad8\u6027\u80fd\u9700\u6c42\u7684\u573a\u666f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6301\u4e45\u5316<\/strong>\uff1a<\/p>\n<ul>\n<li>\u63d0\u4f9b RDB \u548c AOF \u4e24\u79cd\u6301\u4e45\u5316\u673a\u5236\uff0c\u7528\u4e8e\u5c06\u5185\u5b58\u4e2d\u7684\u6570\u636e\u4fdd\u5b58\u5230\u78c1\u76d8\uff0c\u5e76\u652f\u6301\u6570\u636e\u6062\u590d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9ad8\u53ef\u7528\u548c\u5206\u5e03\u5f0f<\/strong>\uff1a<\/p>\n<ul>\n<li>\u901a\u8fc7 Redis Sentinel \u5b9e\u73b0\u9ad8\u53ef\u7528\uff0c\u901a\u8fc7 Redis Cluster \u5b9e\u73b0\u5206\u5e03\u5f0f\u6570\u636e\u5b58\u50a8\u548c\u8d1f\u8f7d\u5747\u8861\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u53d1\u5e03\/\u8ba2\u9605\uff08Pub\/Sub\uff09<\/strong>\uff1a<\/p>\n<ul>\n<li>\u652f\u6301\u6d88\u606f\u53d1\u5e03\/\u8ba2\u9605\u673a\u5236\uff0c\u7528\u4e8e\u5b9e\u73b0\u6d88\u606f\u63a8\u9001\u548c\u901a\u77e5\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3><strong>etcd \u548c Redis \u7684\u533a\u522b<\/strong><\/h3>\n<ol>\n<li>\n<p><strong>\u7528\u9014\u548c\u8bbe\u8ba1\u76ee\u6807<\/strong>\uff1a<\/p>\n<ul>\n<li>\n<p><strong>etcd<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>\u7528\u9014<\/strong>\uff1a\u4e3b\u8981\u7528\u4e8e\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7684\u914d\u7f6e\u5b58\u50a8\u3001\u670d\u52a1\u53d1\u73b0\u548c\u534f\u8c03\u3002\u5b83\u8bbe\u8ba1\u7528\u4e8e\u9ad8\u53ef\u7528\u548c\u5f3a\u4e00\u81f4\u6027\u7684\u914d\u7f6e\u5b58\u50a8\u3002<\/li>\n<li><strong>\u8bbe\u8ba1\u76ee\u6807<\/strong>\uff1a\u4fdd\u8bc1\u4e00\u81f4\u6027\u548c\u9ad8\u53ef\u7528\u6027\uff0c\u9002\u5408\u4e8e\u9700\u8981\u534f\u8c03\u548c\u914d\u7f6e\u7ba1\u7406\u7684\u573a\u666f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Redis<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>\u7528\u9014<\/strong>\uff1a\u4e3b\u8981\u7528\u4e8e\u7f13\u5b58\u3001\u6d88\u606f\u961f\u5217\u548c\u9ad8\u6027\u80fd\u6570\u636e\u5b58\u50a8\u3002\u5b83\u8bbe\u8ba1\u7528\u4e8e\u5feb\u901f\u7684\u6570\u636e\u5b58\u53d6\u548c\u7075\u6d3b\u7684\u6570\u636e\u7ed3\u6784\u652f\u6301\u3002<\/li>\n<li><strong>\u8bbe\u8ba1\u76ee\u6807<\/strong>\uff1a\u63d0\u4f9b\u6781\u9ad8\u7684\u6027\u80fd\u548c\u4e30\u5bcc\u7684\u6570\u636e\u64cd\u4f5c\uff0c\u9002\u5408\u4e8e\u9ad8\u901f\u7f13\u5b58\u3001\u5b9e\u65f6\u5206\u6790\u548c\u6d88\u606f\u4f20\u9012\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6570\u636e\u4e00\u81f4\u6027<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>etcd<\/strong>\uff1a\u63d0\u4f9b\u5f3a\u4e00\u81f4\u6027\uff0c\u57fa\u4e8e Raft \u5171\u8bc6\u7b97\u6cd5\uff0c\u4fdd\u8bc1\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7684\u6570\u636e\u4e00\u81f4\u6027\u3002<\/li>\n<li><strong>Redis<\/strong>\uff1a\u63d0\u4f9b\u6700\u7ec8\u4e00\u81f4\u6027\uff0c\u4e3b\u8981\u901a\u8fc7\u5185\u5b58\u5b58\u50a8\u5b9e\u73b0\u5feb\u901f\u8bfb\u5199\uff0c\u6301\u4e45\u5316\u673a\u5236\u7528\u4e8e\u6570\u636e\u6062\u590d\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u5b58\u50a8\u548c\u6301\u4e45\u5316<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>etcd<\/strong>\uff1a\u6570\u636e\u5b58\u50a8\u5728\u78c1\u76d8\u4e0a\uff0c\u5e76\u901a\u8fc7\u65e5\u5fd7\u8bb0\u5f55\u6765\u4fdd\u6301\u6570\u636e\u7684\u4e00\u81f4\u6027\u548c\u6301\u4e45\u6027\u3002<\/li>\n<li><strong>Redis<\/strong>\uff1a\u4e3b\u8981\u5c06\u6570\u636e\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\uff0c\u5e76\u53ef\u4ee5\u901a\u8fc7\u6301\u4e45\u5316\u673a\u5236\u5c06\u6570\u636e\u4fdd\u5b58\u5230\u78c1\u76d8\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>API \u548c\u64cd\u4f5c<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>etcd<\/strong>\uff1a\u63d0\u4f9b\u7b80\u5355\u7684\u952e\u503c\u5bf9\u64cd\u4f5c\u548c Watch \u529f\u80fd\uff0c\u9002\u5408\u914d\u7f6e\u548c\u72b6\u6001\u7ba1\u7406\u3002<\/li>\n<li><strong>Redis<\/strong>\uff1a\u63d0\u4f9b\u4e30\u5bcc\u7684\u6570\u636e\u7ed3\u6784\u64cd\u4f5c\uff0c\u5305\u62ec\u5b57\u7b26\u4e32\u3001\u5217\u8868\u3001\u54c8\u5e0c\u3001\u96c6\u5408\u7b49\uff0c\u9002\u5408\u591a\u6837\u5316\u7684\u6570\u636e\u5904\u7406\u9700\u6c42\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u9ad8\u53ef\u7528\u6027\u548c\u5206\u5e03\u5f0f\u652f\u6301<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>etcd<\/strong>\uff1a\u901a\u8fc7 Raft \u534f\u8bae\u5b9e\u73b0\u4e00\u81f4\u6027\u548c\u9ad8\u53ef\u7528\u6027\uff0c\u9002\u5408\u9700\u8981\u5f3a\u4e00\u81f4\u6027\u548c\u534f\u8c03\u7684\u573a\u666f\u3002<\/li>\n<li><strong>Redis<\/strong>\uff1a\u901a\u8fc7 Redis Sentinel \u548c Redis Cluster \u5b9e\u73b0\u9ad8\u53ef\u7528\u548c\u5206\u5e03\u5f0f\u6570\u636e\u5b58\u50a8\uff0c\u9002\u5408\u9700\u8981\u9ad8\u6027\u80fd\u548c\u5206\u5e03\u5f0f\u7684\u573a\u666f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3><strong>\u603b\u7ed3<\/strong><\/h3>\n<ul>\n<li><strong>etcd<\/strong> \u4e3b\u8981\u7528\u4e8e\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\u7684\u4e00\u81f4\u6027\u914d\u7f6e\u548c\u670d\u52a1\u53d1\u73b0\uff0c\u8bbe\u8ba1\u76ee\u6807\u662f\u63d0\u4f9b\u5f3a\u4e00\u81f4\u6027\u548c\u9ad8\u53ef\u7528\u6027\u3002<\/li>\n<li><strong>Redis<\/strong> \u4e3b\u8981\u7528\u4e8e\u7f13\u5b58\u3001\u9ad8\u6027\u80fd\u6570\u636e\u5b58\u50a8\u548c\u6d88\u606f\u4f20\u9012\uff0c\u8bbe\u8ba1\u76ee\u6807\u662f\u63d0\u4f9b\u6781\u9ad8\u7684\u6027\u80fd\u548c\u7075\u6d3b\u7684\u6570\u636e\u7ed3\u6784\u652f\u6301\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e24\u8005\u5404\u6709\u7279\u5b9a\u7684\u7528\u9014\u548c\u8bbe\u8ba1\u76ee\u6807\uff0c\u9009\u62e9\u4f7f\u7528\u54ea\u4e00\u4e2a\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u548c\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>etcd \u4ecb\u7ecd etcd \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5206\u5e03\u5f0f\u952e\u503c\u5b58\u50a8\u7cfb\u7edf\uff0c\u4e3b\u8981\u7528\u4e8e\u5b58\u50a8\u548c\u7ba1\u7406\u914d\u7f6e\u6570\u636e\u3001\u670d\u52a1\u53d1\u73b0\u548c\u534f\u8c03\u5de5\u4f5c\u3002\u5b83\u662f&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=6443\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[123],"tags":[142],"class_list":["post-6443","post","type-post","status-publish","format-standard","hentry","category-123","tag-142"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6443"}],"version-history":[{"count":1,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6443\/revisions"}],"predecessor-version":[{"id":6444,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/6443\/revisions\/6444"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}