{"id":33400,"date":"2025-04-27T11:23:23","date_gmt":"2025-04-27T03:23:23","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/33400.html"},"modified":"2025-04-27T11:23:23","modified_gmt":"2025-04-27T03:23:23","slug":"%e3%80%90%e6%98%9f%e6%b5%b7%e5%87%ba%e5%93%81%e3%80%91%e5%88%86%e5%b8%83%e5%bc%8f%e5%ad%98%e5%82%a8%e6%95%b0%e6%8d%ae%e5%ba%93etcd","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/33400.html","title":{"rendered":"\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd"},"content":{"rendered":"<h2>etcd \u6570\u636e\u5e93\u7531 CoreOS \u516c\u53f8\u521b\u5efa\u3002<\/h2>\n<p>https:\/\/github.com\/etcd-io\/etcd<\/p>\n<p>api\u4fe1\u606f https:\/\/etcd.io\/docs\/v3.5\/dev-guide\/api_reference_v3\/ etcdctl &#8211;help<\/p>\n<p>etcd \u6700\u521d\u7531 CoreOS \u516c\u53f8\u5f00\u53d1&#xff0c;\u4f5c\u4e3a\u5176\u6838\u5fc3\u9879\u76ee\u4e4b\u4e00\u3002 CoreOS \u6210\u7acb\u4e8e 2013 \u5e74&#xff0c;\u4e13\u6ce8\u4e8e\u5bb9\u5668\u5316\u6280\u672f&#xff08;\u5982 Linux \u5bb9\u5668\u3001rkt \u5bb9\u5668\u8fd0\u884c\u65f6&#xff09;\u548c\u5206\u5e03\u5f0f\u7cfb\u7edf\u57fa\u7840\u8bbe\u65bd\u3002<\/p>\n<p>2018 \u5e74&#xff0c;CoreOS \u88ab Red Hat \u6536\u8d2d&#xff08;\u540e Red Hat \u53c8\u5e76\u5165 IBM&#xff09;<\/p>\n<p>\u8f7b\u91cf\u7ea7\u3001\u9ad8\u53ef\u7528\u7684\u952e\u503c\u5b58\u50a8&#xff0c;\u7528\u4e8e\u5b58\u50a8\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5173\u952e\u5143\u6570\u636e&#xff08;\u5982\u670d\u52a1\u53d1\u73b0\u3001\u914d\u7f6e\u7ba1\u7406&#xff09;\u3002<\/p>\n<h5>\u5177\u6709\u5f3a\u4e00\u81f4\u6027\u3001\u9ad8\u53ef\u9760\u6027\u548c\u6613\u7528\u6027\u3002<\/h5>\n<p>ETCD \u662f\u4e00\u4e2a\u9ad8\u53ef\u7528\u7684\u5206\u5e03\u5f0f\u952e\u503ckey-value\u6570\u636e\u5e93&#xff0c;\u53ef\u7528\u4e8e\u670d\u52a1\u53d1\u73b0\u3002<\/p>\n<p>etcd \u5b58\u50a8\u4e86 K8s \u96c6\u7fa4\u7684\u6240\u6709\u72b6\u6001&#xff08;\u5982 Pod \u5b9a\u4e49\u3001Service \u914d\u7f6e\u3001\u8282\u70b9\u4fe1\u606f&#xff09;&#xff0c;\u662f\u63a7\u5236\u5e73\u9762\u7684\u201c\u5927\u8111\u201d\u3002 \u57fa\u4e8e Raft \u5171\u8bc6\u7b97\u6cd5&#xff0c;\u63d0\u4f9b\u5f3a\u4e00\u81f4\u6027\u3001\u9ad8\u53ef\u7528\u6027&#xff0c;\u652f\u6301 watch \u673a\u5236\u5b9e\u73b0\u5b9e\u65f6\u6570\u636e\u540c\u6b65\u3002<\/p>\n<p>K8S API \u670d\u52a1\u5668\u63a5\u6536\u5230\u8bf7\u6c42\u540e&#xff0c;\u4f1a\u9a8c\u8bc1\u8bf7\u6c42\u683c\u5f0f\u548c\u5185\u5bb9\u3002\u901a\u8fc7\u9a8c\u8bc1\u7684\u8bf7\u6c42\u4f1a\u88ab\u5b58\u50a8\u5230 etcd&#xff08;Kubernetes \u7684\u5206\u5e03\u5f0f\u6570\u636e\u5e93&#xff09;\u4e2d\u3002 \u5bf9\u8c61\u521b\u5efa&#xff1a;\u4e00\u65e6\u5b58\u50a8\u5728 etcd \u4e2d&#xff0c;Pod \u5c31\u88ab\u6b63\u5f0f\u521b\u5efa&#xff0c;\u6807\u8bb0\u4e3a Pending \u72b6\u6001\u3002<\/p>\n<h3>Raft \u7b97\u6cd5<\/h3>\n<p>https:\/\/www.youtube.com\/watch?v&#061;YbZ3zDzDnrw&#038;feature&#061;youtu.be<\/p>\n<p>\u89d2\u8272 Leader\u9009\u4e3e&#xff08;Leader election&#xff09; \u65e5\u5fd7\u590d\u5236&#xff08;Log replication&#xff09; \u5b89\u5168\u6027&#xff08;Safety&#xff09; \u65e5\u5fd7\u538b\u7f29&#xff08;Log compaction&#xff09;<\/p>\n<p>Raft\u5c06\u7cfb\u7edf\u4e2d\u7684\u89d2\u8272\u5206\u4e3a\u9886\u5bfc\u8005&#xff08;Leader&#xff09;\u3001\u8ddf\u4ece\u8005&#xff08;Follower&#xff09;\u548c\u5019\u9009\u8005&#xff08;Candidate&#xff09;<\/p>\n<p>Leader&#xff1a;\u63a5\u53d7\u5ba2\u6237\u7aef\u8bf7\u6c42&#xff0c;\u5e76\u5411Follower\u540c\u6b65\u8bf7\u6c42\u65e5\u5fd7&#xff0c;\u5f53\u65e5\u5fd7\u540c\u6b65\u5230\u5927\u591a\u6570\u8282\u70b9\u4e0a\u540e\u544a\u8bc9Follower\u63d0\u4ea4\u65e5\u5fd7\u3002 Follower&#xff1a;\u63a5\u53d7\u5e76\u6301\u4e45\u5316Leader\u540c\u6b65\u7684\u65e5\u5fd7&#xff0c;\u5728Leader\u544a\u4e4b\u65e5\u5fd7\u53ef\u4ee5\u63d0\u4ea4\u4e4b\u540e&#xff0c;\u63d0\u4ea4\u65e5\u5fd7\u3002 Candidate&#xff1a;Leader\u9009\u4e3e\u8fc7\u7a0b\u4e2d\u7684\u4e34\u65f6\u89d2\u8272\u3002<\/p>\n<p>Raft \u4efb\u610f\u65f6\u523b\u6700\u591a\u53ea\u6709\u4e00\u4e2aLeader&#xff0c;\u6b63\u5e38\u5de5\u4f5c\u671f\u95f4\u53ea\u6709Leader\u548cFollowers\u3002 Raft\u7b97\u6cd5\u5c06\u65f6\u95f4\u5206\u4e3a\u4e00\u4e2a\u4e2a\u7684\u5468\u671f&#xff08;term&#xff09; \u9009\u4e3eLeader\u4e4b\u540e&#xff0c;Leader\u4f1a\u5728\u6574\u4e2a\u5468\u671f\u5185\u7ba1\u7406\u6574\u4e2a\u96c6\u7fa4 \u5982\u679cLeader\u9009\u4e3e\u5931\u8d25&#xff0c;\u8be5term\u5c31\u4f1a\u56e0\u4e3a\u6ca1\u6709Leader\u800c\u7ed3\u675f\u3002 \u6ca1\u6709\u670d\u52a1\u5668\u8d62\u5f97\u591a\u6570\u7684\u9009\u7968&#xff0c;Leader\u9009\u4e3e\u5931\u8d25&#xff0c;\u7b49\u5f85\u9009\u4e3e\u65f6\u95f4\u8d85\u65f6\u540e\u53d1\u8d77\u4e0b\u4e00\u6b21\u9009\u4e3e\u3002<\/p>\n<p>leader\u4f1a\u5b9a\u671f\u53d1\u9001\u5fc3\u8df3&#xff0c;\u6839\u636e\u552f\u4e00Term\u6807\u8bc6\u8fdb\u884c\u901a\u4fe1 \u9009\u4e3e\u8d85\u65f6\u968f\u673a\u5316&#xff1a;\u8282\u70b9\u5728\u8d85\u65f6\u65f6\u95f4\u5185\u672a\u6536\u5230leader\u5fc3\u8df3\u4f1a\u53d1\u8d77\u9009\u4e3e&#xff0c;\u4f46\u8d85\u65f6\u65f6\u95f4\u968f\u673a\u5316&#xff08;\u5982150ms-300ms&#xff09;&#xff0c;\u786e\u4fdd\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u53ea\u6709\u4e00\u4e2a\u8282\u70b9\u7387\u5148\u53d1\u8d77\u9009\u4e3e\u3002<\/p>\n<p>Follower\u5c06\u5176\u5f53\u524dterm\u52a0\u4e00\u7136\u540e\u8f6c\u6362\u4e3aCandidate\u3002 \u5b83\u9996\u5148\u7ed9\u81ea\u5df1\u6295\u7968\u5e76\u4e14\u7ed9\u96c6\u7fa4\u4e2d\u7684\u5176\u4ed6\u670d\u52a1\u5668\u53d1\u9001 RequestVote RPC\u3002<\/p>\n<p>\u5f53\u65e7leader\u6062\u590d\u65f6&#xff0c;\u5b83\u4f1a\u53d1\u73b0\u5f53\u524dTerm\u5df2\u8d85\u8fc7\u81ea\u5df1\u7684Term&#xff0c;\u7acb\u5373\u5207\u6362\u4e3aFollower\u72b6\u6001&#xff0c;\u5e76\u63a5\u53d7\u65b0leader\u7684\u65e5\u5fd7\u3002 \u5982\u679c\u65e7leader\u5728\u5931\u8054\u671f\u95f4\u63d0\u4ea4\u4e86\u90e8\u5206\u65e5\u5fd7&#xff0c;\u65b0leader\u4f1a\u901a\u8fc7\u65e5\u5fd7\u590d\u5236\u673a\u5236&#xff08;AppendEntries RPC&#xff09;\u5f3a\u5236\u65e7leader\u56de\u9000\u51b2\u7a81\u65e5\u5fd7&#xff0c;\u786e\u4fdd\u5168\u5c40\u4e00\u81f4\u6027\u3002<\/p>\n<p>\u65e5\u5fd7\u51b2\u7a81\u5904\u7406&#xff1a;\u5982\u679c\u65e7leader\u5728\u5931\u8054\u671f\u95f4\u63d0\u4ea4\u4e86\u90e8\u5206\u65e5\u5fd7&#xff0c;\u65b0leader\u4f1a\u901a\u8fc7\u65e5\u5fd7\u590d\u5236\u673a\u5236&#xff08;AppendEntries RPC&#xff09;\u5f3a\u5236\u65e7leader\u56de\u9000\u51b2\u7a81\u65e5\u5fd7&#xff0c;\u786e\u4fdd\u5168\u5c40\u4e00\u81f4\u6027\u3002<\/p>\n<p>Raft\u8981\u6c42leader\u5fc5\u987b\u83b7\u5f97\u8d85\u8fc7\u534a\u6570\u7684\u8282\u70b9\u786e\u8ba4&#xff08;quorum&#xff09;\u624d\u80fd\u63d0\u4ea4\u65e5\u5fd7\u3002\u5373\u4f7f\u7f51\u7edc\u5206\u533a\u5bfc\u81f4\u90e8\u5206\u8282\u70b9\u9694\u79bb&#xff0c;\u53ea\u6709\u62e5\u6709\u591a\u6570\u8282\u70b9\u7684\u5206\u533a\u80fd\u9009\u4e3e\u65b0leader&#xff0c;\u53e6\u4e00\u5206\u533a\u65e0\u6cd5\u5f62\u6210\u6709\u6548\u9009\u4e3e\u3002<\/p>\n<p>Raft\u4fdd\u8bc1\u65b0leader\u4e00\u5b9a\u5305\u542b\u6240\u6709\u5df2\u63d0\u4ea4\u7684\u65e5\u5fd7&#xff08;\u901a\u8fc7RequestVote\u9636\u6bb5\u7684\u65e5\u5fd7\u5b8c\u6574\u6027\u68c0\u67e5&#xff09;&#xff0c;\u907f\u514d\u65e5\u5fd7\u5206\u53c9\u3002<\/p>\n<p>\u5982\u679cleader\u7a81\u7136\u5d29\u6e83\u5bfc\u81f4\u7f3a\u5c11\u4e86\u4e00\u6761followers\u7684\u6761\u76ee,\u5219Leader\u4e3a\u4e86\u4f7fFollowers\u7684\u65e5\u5fd7\u540c\u81ea\u5df1\u7684\u4e00\u81f4&#xff0c;Leader\u9700\u8981\u627e\u5230Followers\u540c\u5b83\u7684\u65e5\u5fd7\u4e00\u81f4\u7684\u5730\u65b9&#xff0c;\u7136\u540e\u8986\u76d6Followers\u5728\u8be5\u4f4d\u7f6e\u4e4b\u540e\u7684\u6761\u76ee\u3002 \u5f53 leader \u548c follower \u65e5\u5fd7\u51b2\u7a81\u7684\u65f6\u5019&#xff0c;leader \u5c06\u6821\u9a8c follower \u6700\u540e\u4e00\u6761\u65e5\u5fd7\u662f\u5426\u548c leader \u5339\u914d&#xff0c;\u5982\u679c\u4e0d\u5339\u914d&#xff0c;\u5c06\u9012\u51cf\u67e5\u8be2&#xff0c;\u76f4\u5230\u5339\u914d&#xff0c;\u5339\u914d\u540e&#xff0c;\u5220\u9664\u51b2\u7a81\u7684\u65e5\u5fd7\u3002\u8fd9\u6837\u5c31\u5b9e\u73b0\u4e86\u4e3b\u4ece\u65e5\u5fd7\u7684\u4e00\u81f4\u6027\u3002 Leader\u4f1a\u901a\u8fc7RPC\u5411follower\u53d1\u51fa\u65e5\u5fd7\u590d\u5236&#xff0c;\u7b49\u5f85\u6240\u6709\u7684follower\u590d\u5236\u5b8c\u6210&#xff0c;\u8fd9\u4e2a\u8fc7\u7a0b\u662f\u963b\u585e\u7684\u3002 \u8001\u7684leader\u91cc\u9762\u6ca1\u63d0\u4ea4\u7684\u6570\u636e\u4f1a\u56de\u6eda&#xff0c;\u7136\u540e\u540c\u6b65\u65b0leader\u7684\u6570\u636e\u3002<\/p>\n<h5>\u6301\u4e45\u5316<\/h5>\n<p>etcd \u901a\u8fc7 WAL &#043; Snapshot \u7684\u7ec4\u5408 \u65e5\u5fd7\u4f1a\u5b9a\u671f\u538b\u7f29&#xff0c;\u5e26\u6709\u5feb\u7167\u529f\u80fd Leader \u8282\u70b9\u4f1a\u4fdd\u7559\u6240\u6709\u672a\u63d0\u4ea4\u7684\u65e5\u5fd7\u6761\u76ee&#xff0c;\u4f46\u5df2\u63d0\u4ea4\u7684\u65e5\u5fd7\u4f1a\u5728\u4ee5\u4e0b\u6761\u4ef6\u89e6\u53d1\u538b\u7f29<\/p>\n<p>\u5df2\u63a5\u653610000\u6761\u65e5\u5fd7\u6761\u76ee&#xff0c;\u6216\u8005\u8d85\u8fc75\u5206\u949f<\/p>\n<p>\u65e5\u5fd7\u4fdd\u7559\u7b56\u7565&#xff1a;\u5feb\u7167\u751f\u6210\u540e&#xff0c;\u6240\u6709\u65e9\u4e8e\u8be5\u5feb\u7167\u7684\u65e5\u5fd7\u4f1a\u88ab\u6807\u8bb0\u4e3a\u53ef\u5220\u9664\u3002<\/p>\n<p>\u6bcf\u4e2a\u8282\u70b9\u4e0a\u7684kubelet\u5b9a\u671f\u5411API Server\u4e0a\u62a5\u8282\u70b9\u72b6\u6001&#xff08;\u5982CPU\u3001\u5185\u5b58\u3001\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5&#xff09;&#xff0c;API Server\u5c06\u8fd9\u4e9b\u4fe1\u606f\u5199\u5165etcd\u3002 \u5f53\u521b\u5efaPod\u65f6&#xff0c;API Server\u5c06Pod\u7684\u5143\u6570\u636e&#xff08;\u5982\u540d\u79f0\u3001\u6807\u7b7e\u3001\u5bb9\u5668\u955c\u50cf\u7b49&#xff09;\u5199\u5165etcd\u3002<\/p>\n<p>\u8c03\u5ea6\u5668\u4eceetcd\u8bfb\u53d6\u8282\u70b9\u72b6\u6001\u548cPod\u5143\u6570\u636e&#xff0c;\u57fa\u4e8e\u7b97\u6cd5&#xff08;\u5982\u8d44\u6e90\u5339\u914d\u3001\u4eb2\u548c\u6027\u89c4\u5219&#xff09;\u9009\u62e9\u6700\u4f73\u8282\u70b9&#xff0c;\u5e76\u5c06\u8c03\u5ea6\u7ed3\u679c\u5199\u56deetcd\u3002<\/p>\n<p>etcd\u4f7f\u7528Raft\u7b97\u6cd5\u4fdd\u8bc1\u5f3a\u4e00\u81f4\u6027&#xff0c;\u786e\u4fdd\u6240\u6709\u8282\u70b9\u770b\u5230\u7684\u6570\u636e\u89c6\u56fe\u4e00\u81f4\u3002\u8fd9\u5bf9\u8c03\u5ea6\u5668\u7684\u51b3\u7b56\u81f3\u5173\u91cd\u8981&#xff0c;\u907f\u514d\u201c\u88c2\u8111\u201d\u95ee\u9898\u3002<\/p>\n<p>etcd\u901a\u8fc7\u591a\u7248\u672c\u63a7\u5236\u7cfb\u7edf&#xff08;MVCC&#xff09;\u4fdd\u5b58\u952e\u503c\u7684\u6240\u6709\u5386\u53f2\u53d8\u66f4 \u9ed8\u8ba4\u4fdd\u7559\u6700\u8fd11000\u4e2a\u7248\u672c&#xff0c;\u65e7\u7248\u672c\u4f1a\u88ab\u5408\u5e76\u5230\u5386\u53f2\u6587\u4ef6\u3002 MVCC\u7248\u672c\u53f7\u9012\u589e&#xff1a;\u6bcf\u6b21\u4fee\u6539\u64cd\u4f5c&#xff08;\u5982 PUT\u3001DELETE&#xff09;\u5747\u89e6\u53d1\u5168\u5c40\u7248\u672c\u53f7\u52a01&#xff0c;\u652f\u6301\u6570\u636e\u8ffd\u6eaf\u548c\u5e76\u53d1\u63a7\u5236\u3002 \u542f\u52a8\u53c2\u6570\u4f5c\u7528&#xff1a;<\/p>\n<p>\u5efa\u8bae\u901a\u8fc7 etcdctl endpoint status \u6216\u76d1\u63a7\u5de5\u5177&#xff08;\u5982 Prometheus&#xff09;\u89c2\u5bdf\u7248\u672c\u53f7\u548c\u5b58\u50a8\u4f7f\u7528\u60c5\u51b5&#xff0c;\u7ed3\u5408\u4e1a\u52a1\u9700\u6c42\u8c03\u6574\u53c2\u6570\u914d\u7f6e\u3002<\/p>\n<h6>\u7a7a\u95f4\u95ee\u9898<\/h6>\n<p>\u2013auto-compaction-retention \u4f5c\u7528&#xff1a;\u8bbe\u7f6e\u81ea\u52a8\u538b\u7f29&#xff08;Auto-Compaction&#xff09;\u7684\u4fdd\u7559\u7b56\u7565&#xff0c;\u63a7\u5236\u65e7\u7248\u672c\u6570\u636e\u7684\u4fdd\u7559\u65f6\u95f4\u3002 \u539f\u7406&#xff1a;ETCD\u4f1a\u5b9a\u671f\u6e05\u7406\u4f4e\u4e8e\u6307\u5b9a\u4fdd\u7559\u65f6\u95f4\u7684\u65e7\u7248\u672c\u6570\u636e&#xff0c;\u91ca\u653e\u5b58\u50a8\u7a7a\u95f4\u3002 \u914d\u7f6e\u793a\u4f8b&#xff1a; \u2013auto-compaction-retention&#061;1h&#xff1a;\u4fdd\u7559\u6700\u8fd11\u5c0f\u65f6\u5185\u7684\u6570\u636e&#xff0c;\u81ea\u52a8\u538b\u7f29\u66f4\u65e9\u7684\u7248\u672c\u3002 \u82e5\u672a\u914d\u7f6e\u6b64\u53c2\u6570&#xff0c;\u9ed8\u8ba4\u7981\u7528\u81ea\u52a8\u538b\u7f29&#xff08;\u9700\u624b\u52a8\u6267\u884c compact \u547d\u4ee4&#xff09;\u3002 \u2013auto-compaction-mode&#xff1a;\u5b9a\u4e49\u538b\u7f29\u6a21\u5f0f&#xff0c;\u53ef\u9009 periodic&#xff08;\u57fa\u4e8e\u65f6\u95f4&#xff09;\u6216 revision&#xff08;\u57fa\u4e8e\u7248\u672c\u53f7&#xff09;\u3002 \u793a\u4f8b&#xff1a;\u2013auto-compaction-mode&#061;periodic &#8211;auto-compaction-retention&#061;5m \u8868\u793a\u6bcf5\u5206\u949f\u538b\u7f29\u4e00\u6b21\u65e7\u6570\u636e\u3002<\/p>\n<p>\u2013quota-backend-bytes \u4f5c\u7528&#xff1a;\u8bbe\u7f6e\u540e\u7aef\u5b58\u50a8&#xff08;Backend Storage&#xff09;\u7684\u914d\u989d&#xff0c;\u9650\u5236\u6570\u636e\u5e93\u7684\u6700\u5927\u5927\u5c0f\u3002 \u539f\u7406&#xff1a;\u5f53\u6570\u636e\u5e93\u5927\u5c0f\u8d85\u8fc7\u914d\u989d\u65f6&#xff0c;ETCD\u4f1a\u89e6\u53d1\u8b66\u62a5\u6216\u81ea\u52a8\u538b\u7f29\u64cd\u4f5c\u3002 \u914d\u7f6e\u793a\u4f8b&#xff1a; \u2013quota-backend-bytes&#061;8589934592&#xff1a;\u9650\u5236\u6570\u636e\u5e93\u5927\u5c0f\u4e3a8GB&#xff08;\u9ed8\u8ba4\u503c\u901a\u5e38\u4e3a2GB&#xff09;\u3002 \u82e5\u672a\u914d\u7f6e\u6b64\u53c2\u6570&#xff0c;\u4f7f\u7528\u9ed8\u8ba4\u914d\u989d&#xff08;\u53ef\u80fd\u56e0\u7248\u672c\u4e0d\u540c\u800c\u6709\u6240\u5dee\u5f02&#xff09;\u3002<\/p>\n<p>\u53c2\u8003\u6587\u6863&#xff1a;https:\/\/cloud.tencent.com\/developer\/article\/2182442?areaSource&#061;102001.19&amp;traceId&#061;NJua_dMWh91JYgM2Cm7jT <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250427032322-680da32a48ed6.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>RPC<\/h4>\n<p>Raft \u7b97\u6cd5\u4e2d\u670d\u52a1\u5668\u8282\u70b9\u4e4b\u95f4\u901a\u4fe1\u4f7f\u7528\u8fdc\u7a0b\u8fc7\u7a0b\u8c03\u7528&#xff08;RPC&#xff09;<\/p>\n<p>RequestVote RPC&#xff1a;\u5019\u9009\u4eba\u5728\u9009\u4e3e\u671f\u95f4\u53d1\u8d77\u3002<\/p>\n<p>AppendEntries RPC&#xff1a;\u9886\u5bfc\u4eba\u53d1\u8d77\u7684\u4e00\u79cd\u5fc3\u8df3\u673a\u5236&#xff0c;\u590d\u5236\u65e5\u5fd7\u4e5f\u5728\u8be5\u547d\u4ee4\u4e2d\u5b8c\u6210\u3002<\/p>\n<p>InstallSnapshot RPC: \u9886\u5bfc\u8005\u4f7f\u7528\u8be5RPC\u6765\u53d1\u9001\u5feb\u7167\u7ed9\u592a\u843d\u540e\u7684\u8ffd\u968f\u8005\u3002<\/p>\n<h4>\u5916\u90e8etcd\u5173\u8054<\/h4>\n<p>\u5728 kubeadm \u914d\u7f6e\u4e2d\u6307\u5b9a\u5916\u90e8 etcd kubeadm init &#8211;config kubeadm-config.yaml<\/p>\n<p><span class=\"token comment\"># kubeadm-config.yaml<\/span><br \/>\napiVersion: kubeadm.k8s.io\/v1beta3<br \/>\nkind: InitConfiguration<br \/>\netcd:<br \/>\n  external:<br \/>\n    endpoints:<br \/>\n    &#8211; https:\/\/etcd-node1:2379<br \/>\n    &#8211; https:\/\/etcd-node2:2379<br \/>\n    &#8211; https:\/\/etcd-node3:2379<br \/>\n    caFile: \/etc\/ssl\/etcd\/ca.crt<br \/>\n    certFile: \/etc\/ssl\/etcd\/client.crt<br \/>\n    keyFile: \/etc\/ssl\/etcd\/client.key<\/p>\n<h6>\u9759\u6001pod<\/h6>\n<p><span class=\"token comment\"># etcd-pod.yaml<\/span><br \/>\napiVersion: v1<br \/>\nkind: Pod<br \/>\nmetadata:<br \/>\n  name: etcd<br \/>\n  namespace: kube-system<br \/>\nspec:<br \/>\n  containers:<br \/>\n  &#8211; name: etcd<br \/>\n    image: quay.io\/coreos\/etcd:v3.5.9<br \/>\n    command:<br \/>\n    &#8211; etcd<br \/>\n    &#8211; &#8211;advertise-client-urls<span class=\"token operator\">&#061;<\/span>http:\/\/0.0.0.0:2379<br \/>\n    &#8211; &#8211;listen-client-urls<span class=\"token operator\">&#061;<\/span>http:\/\/0.0.0.0:2379<br \/>\n  hostNetwork: <span class=\"token boolean\">true<\/span><br \/>\n  volumes:<br \/>\n  &#8211; name: etcd-data<br \/>\n    hostPath:<br \/>\n      path: \/var\/lib\/etcd<\/p>\n<p>kubectl apply -f etcd-pod.yaml<\/p>\n<p>\u7f51\u7edc\u76f8\u5173<\/p>\n<p>Calico Source Code https:\/\/github.com\/projectcalico\/calico<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb812\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf14\u6b21\u3002api\u4fe1\u606fetcd \u6700\u521d\u7531 CoreOS \u516c\u53f8\u5f00\u53d1\uff0c\u4f5c\u4e3a\u5176\u6838\u5fc3\u9879\u76ee\u4e4b\u4e00\u3002CoreOS \u6210\u7acb\u4e8e 2013 \u5e74\uff0c\u4e13\u6ce8\u4e8e\u5bb9\u5668\u5316\u6280\u672f\uff08\u5982 Linux \u5bb9\u5668\u3001rkt \u5bb9\u5668\u8fd0\u884c\u65f6\uff09\u548c\u5206\u5e03\u5f0f\u7cfb\u7edf\u57fa\u7840\u8bbe\u65bd\u30022018 \u5e74\uff0cCoreOS \u88ab Red Hat \u6536\u8d2d\uff08\u540e Red Hat \u53c8\u5e76\u5165 IBM\uff09\u8f7b\u91cf\u7ea7\u3001\u9ad8\u53ef\u7528\u7684\u952e\u503c\u5b58\u50a8\uff0c\u7528\u4e8e\u5b58\u50a8\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5173\u952e\u5143\u6570\u636e\uff08\u5982\u670d\u52a1\u53d1\u73b0\u3001\u914d\u7f6e\u7ba1\u7406\uff09\u3002<\/p>\n","protected":false},"author":2,"featured_media":33399,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1686,664,100],"topic":[],"class_list":["post-33400","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-etcd","tag-664","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/33400.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb812\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf14\u6b21\u3002api\u4fe1\u606fetcd \u6700\u521d\u7531 CoreOS \u516c\u53f8\u5f00\u53d1\uff0c\u4f5c\u4e3a\u5176\u6838\u5fc3\u9879\u76ee\u4e4b\u4e00\u3002CoreOS \u6210\u7acb\u4e8e 2013 \u5e74\uff0c\u4e13\u6ce8\u4e8e\u5bb9\u5668\u5316\u6280\u672f\uff08\u5982 Linux \u5bb9\u5668\u3001rkt \u5bb9\u5668\u8fd0\u884c\u65f6\uff09\u548c\u5206\u5e03\u5f0f\u7cfb\u7edf\u57fa\u7840\u8bbe\u65bd\u30022018 \u5e74\uff0cCoreOS \u88ab Red Hat \u6536\u8d2d\uff08\u540e Red Hat \u53c8\u5e76\u5165 IBM\uff09\u8f7b\u91cf\u7ea7\u3001\u9ad8\u53ef\u7528\u7684\u952e\u503c\u5b58\u50a8\uff0c\u7528\u4e8e\u5b58\u50a8\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5173\u952e\u5143\u6570\u636e\uff08\u5982\u670d\u52a1\u53d1\u73b0\u3001\u914d\u7f6e\u7ba1\u7406\uff09\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/33400.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-27T03:23:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250427032322-680da32a48ed6.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/33400.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/33400.html\",\"name\":\"\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-27T03:23:23+00:00\",\"dateModified\":\"2025-04-27T03:23:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/33400.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/33400.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/33400.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/33400.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb812\u6b21\uff0c\u70b9\u8d5e18\u6b21\uff0c\u6536\u85cf14\u6b21\u3002api\u4fe1\u606fetcd \u6700\u521d\u7531 CoreOS \u516c\u53f8\u5f00\u53d1\uff0c\u4f5c\u4e3a\u5176\u6838\u5fc3\u9879\u76ee\u4e4b\u4e00\u3002CoreOS \u6210\u7acb\u4e8e 2013 \u5e74\uff0c\u4e13\u6ce8\u4e8e\u5bb9\u5668\u5316\u6280\u672f\uff08\u5982 Linux \u5bb9\u5668\u3001rkt \u5bb9\u5668\u8fd0\u884c\u65f6\uff09\u548c\u5206\u5e03\u5f0f\u7cfb\u7edf\u57fa\u7840\u8bbe\u65bd\u30022018 \u5e74\uff0cCoreOS \u88ab Red Hat \u6536\u8d2d\uff08\u540e Red Hat \u53c8\u5e76\u5165 IBM\uff09\u8f7b\u91cf\u7ea7\u3001\u9ad8\u53ef\u7528\u7684\u952e\u503c\u5b58\u50a8\uff0c\u7528\u4e8e\u5b58\u50a8\u5206\u5e03\u5f0f\u7cfb\u7edf\u7684\u5173\u952e\u5143\u6570\u636e\uff08\u5982\u670d\u52a1\u53d1\u73b0\u3001\u914d\u7f6e\u7ba1\u7406\uff09\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/33400.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-27T03:23:23+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250427032322-680da32a48ed6.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/33400.html","url":"https:\/\/www.wsisp.com\/helps\/33400.html","name":"\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-27T03:23:23+00:00","dateModified":"2025-04-27T03:23:23+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/33400.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/33400.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/33400.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u661f\u6d77\u51fa\u54c1\u3011\u5206\u5e03\u5f0f\u5b58\u50a8\u6570\u636e\u5e93etcd"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/33400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=33400"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/33400\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/33399"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=33400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=33400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=33400"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=33400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}