{"id":148475,"date":"2024-11-01T13:59:56","date_gmt":"2024-11-01T05:59:56","guid":{"rendered":"https:\/\/server.hk\/cnblog\/148475\/"},"modified":"2024-11-01T13:59:56","modified_gmt":"2024-11-01T05:59:56","slug":"zookeeper%e6%95%b8%e6%93%9a%e5%ba%ab%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6%e7%9a%84%e5%ae%8c%e6%95%b4%e6%8c%87%e5%8d%97-zookeeper%e6%95%b8%e6%93%9a%e5%ba%ab%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/148475\/","title":{"rendered":"Zookeeper\u6578\u64da\u5eab\u914d\u7f6e\u6587\u4ef6\u7684\u5b8c\u6574\u6307\u5357 (zookeeper\u6578\u64da\u5eab\u914d\u7f6e\u6587\u4ef6)"},"content":{"rendered":"<h1 id=\"zookeeper%e6%95%b8%e6%93%9a%e5%ba%ab%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6%e7%9a%84%e5%ae%8c%e6%95%b4%e6%8c%87%e5%8d%97-GauRIQnPAm\">Zookeeper\u6578\u64da\u5eab\u914d\u7f6e\u6587\u4ef6\u7684\u5b8c\u6574\u6307\u5357<\/h1>\n<p>\u5728\u5206\u5e03\u5f0f\u7cfb\u7d71\u4e2d\uff0cZookeeper\u662f\u4e00\u500b\u91cd\u8981\u7684\u7d44\u4ef6\uff0c\u4e3b\u8981\u7528\u65bc\u5354\u8abf\u548c\u7ba1\u7406\u5206\u5e03\u5f0f\u61c9\u7528\u7a0b\u5e8f\u7684\u914d\u7f6e\u3001\u547d\u540d\u3001\u540c\u6b65\u548c\u96c6\u7fa4\u7ba1\u7406\u3002Zookeeper\u7684\u914d\u7f6e\u6587\u4ef6\u5c0d\u65bc\u5176\u6b63\u5e38\u904b\u884c\u81f3\u95dc\u91cd\u8981\uff0c\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eZookeeper\u6578\u64da\u5eab\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5e6b\u52a9\u7528\u6236\u66f4\u597d\u5730\u7406\u89e3\u548c\u914d\u7f6eZookeeper\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afzookeeper%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6%ef%bc%9f-GauRIQnPAm\">\u4ec0\u9ebc\u662fZookeeper\u914d\u7f6e\u6587\u4ef6\uff1f<\/h2>\n<p>Zookeeper\u7684\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u662f\u4ee5\u6587\u672c\u683c\u5f0f\u5b58\u5728\uff0c\u6587\u4ef6\u540d\u9ed8\u8a8d\u70ba<code>zoo.cfg<\/code>\u3002\u9019\u500b\u6587\u4ef6\u5305\u542b\u4e86Zookeeper\u670d\u52d9\u5668\u7684\u57fa\u672c\u8a2d\u7f6e\uff0c\u5305\u62ec\u670d\u52d9\u5668\u7684ID\u3001\u7aef\u53e3\u865f\u3001\u6578\u64da\u5b58\u5132\u8def\u5f91\u7b49\u3002\u6b63\u78ba\u7684\u914d\u7f6e\u53ef\u4ee5\u78ba\u4fddZookeeper\u7684\u9ad8\u6548\u904b\u884c\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e9%85%8d%e7%bd%ae%e9%a0%85%e7%9b%ae-GauRIQnPAm\">\u57fa\u672c\u914d\u7f6e\u9805\u76ee<\/h2>\n<p>\u4ee5\u4e0b\u662fZookeeper\u914d\u7f6e\u6587\u4ef6\u4e2d\u4e00\u4e9b\u5e38\u898b\u7684\u914d\u7f6e\u9805\u76ee\uff1a<\/p>\n<ul>\n<li><strong>dataDir<\/strong>: \u6307\u5b9aZookeeper\u5b58\u5132\u6578\u64da\u7684\u76ee\u9304\u3002\u9019\u662fZookeeper\u7528\u4f86\u5b58\u5132\u5176\u72c0\u614b\u548c\u5feb\u7167\u7684\u5730\u65b9\u3002<\/li>\n<li><strong>clientPort<\/strong>: \u5b9a\u7fa9\u5ba2\u6236\u7aef\u9023\u63a5Zookeeper\u670d\u52d9\u5668\u7684\u7aef\u53e3\u865f\u3002\u9ed8\u8a8d\u70ba<code>2181<\/code>\u3002<\/li>\n<li><strong>tickTime<\/strong>: Zookeeper\u7684\u57fa\u672c\u6642\u9593\u55ae\u4f4d\uff0c\u55ae\u4f4d\u70ba\u6beb\u79d2\u3002\u5b83\u7528\u65bc\u63a7\u5236\u5fc3\u8df3\u548c\u8d85\u6642\u7b49\u64cd\u4f5c\uff0c\u9ed8\u8a8d\u503c\u70ba<code>2000<\/code>\u3002<\/li>\n<li><strong>initLimit<\/strong>: \u5b9a\u7fa9Zookeeper\u96c6\u7fa4\u4e2d\uff0c\u5f9e\u670d\u52d9\u5668\u521d\u59cb\u5316\u5230\u9023\u63a5\u7684\u6700\u5927\u6642\u9593\u9650\u5236\u3002<\/li>\n<li><strong>syncLimit<\/strong>: \u5b9a\u7fa9Zookeeper\u96c6\u7fa4\u4e2d\uff0c\u4e3b\u670d\u52d9\u5668\u548c\u5f9e\u670d\u52d9\u5668\u4e4b\u9593\u7684\u6700\u5927\u540c\u6b65\u6642\u9593\u9650\u5236\u3002<\/li>\n<li><strong>server.X<\/strong>: \u5b9a\u7fa9\u96c6\u7fa4\u4e2d\u7684\u670d\u52d9\u5668\uff0c<code>X<\/code>\u662f\u670d\u52d9\u5668\u7684ID\uff0c\u683c\u5f0f\u70ba<code>server.ID=host:port:port<\/code>\u3002<\/li>\n<\/ul>\n<h2 id=\"%e9%85%8d%e7%bd%ae%e7%a4%ba%e4%be%8b-GauRIQnPAm\">\u914d\u7f6e\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684Zookeeper\u914d\u7f6e\u6587\u4ef6\u793a\u4f8b\uff1a<\/p>\n<pre><code>dataDir=\/var\/lib\/zookeeper\nclientPort=2181\ntickTime=2000\ninitLimit=10\nsyncLimit=5\nserver.1=192.168.1.1:2888:3888\nserver.2=192.168.1.2:2888:3888\nserver.3=192.168.1.3:2888:3888\n<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c<code>dataDir<\/code>\u6307\u5b9a\u4e86\u6578\u64da\u5b58\u5132\u7684\u8def\u5f91\uff0c<code>clientPort<\/code>\u8a2d\u7f6e\u4e86\u5ba2\u6236\u7aef\u9023\u63a5\u7684\u7aef\u53e3\uff0c\u4e26\u4e14\u5b9a\u7fa9\u4e86\u4e09\u500b\u670d\u52d9\u5668\u7684IP\u5730\u5740\u548c\u7aef\u53e3\u3002<\/p>\n<h2 id=\"%e9%ab%98%e7%b4%9a%e9%85%8d%e7%bd%ae%e9%81%b8%e9%a0%85-GauRIQnPAm\">\u9ad8\u7d1a\u914d\u7f6e\u9078\u9805<\/h2>\n<p>\u9664\u4e86\u57fa\u672c\u914d\u7f6e\u5916\uff0cZookeeper\u9084\u652f\u6301\u4e00\u4e9b\u9ad8\u7d1a\u914d\u7f6e\u9078\u9805\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li><strong>autopurge.snapRetainCount<\/strong>: \u81ea\u52d5\u6e05\u9664\u5feb\u7167\u7684\u4fdd\u7559\u6578\u91cf\u3002<\/li>\n<li><strong>autopurge.purgeInterval<\/strong>: \u81ea\u52d5\u6e05\u9664\u7684\u6642\u9593\u9593\u9694\uff0c\u55ae\u4f4d\u70ba\u5c0f\u6642\u3002<\/li>\n<\/ul>\n<p>\u9019\u4e9b\u9078\u9805\u53ef\u4ee5\u5e6b\u52a9\u7528\u6236\u7ba1\u7406Zookeeper\u7684\u5b58\u5132\u7a7a\u9593\uff0c\u907f\u514d\u56e0\u70ba\u5feb\u7167\u904e\u591a\u800c\u5c0e\u81f4\u7684\u6027\u80fd\u554f\u984c\u3002<\/p>\n<h2 id=\"%e9%85%8d%e7%bd%ae%e6%96%87%e4%bb%b6%e7%9a%84%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-GauRIQnPAm\">\u914d\u7f6e\u6587\u4ef6\u7684\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5728\u7de8\u8f2fZookeeper\u7684\u914d\u7f6e\u6587\u4ef6\u6642\uff0c\u61c9\u6ce8\u610f\u4ee5\u4e0b\u5e7e\u9ede\uff1a<\/p>\n<ul>\n<li>\u78ba\u4fdd\u6bcf\u500b\u914d\u7f6e\u9805\u7684\u683c\u5f0f\u6b63\u78ba\uff0c\u7279\u5225\u662f\u670d\u52d9\u5668\u7684\u914d\u7f6e\u3002<\/li>\n<li>\u5728\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u5f8c\uff0c\u9700\u91cd\u555fZookeeper\u670d\u52d9\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/li>\n<li>\u5b9a\u671f\u6aa2\u67e5\u548c\u6e05\u7406\u6578\u64da\u76ee\u9304\uff0c\u4ee5\u4fdd\u6301\u7cfb\u7d71\u7684\u7a69\u5b9a\u6027\u548c\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-GauRIQnPAm\">\u7e3d\u7d50<\/h2>\n<p>Zookeeper\u7684\u914d\u7f6e\u6587\u4ef6\u662f\u5176\u6b63\u5e38\u904b\u884c\u7684\u57fa\u790e\uff0c\u6b63\u78ba\u7684\u914d\u7f6e\u53ef\u4ee5\u63d0\u9ad8\u7cfb\u7d71\u7684\u7a69\u5b9a\u6027\u548c\u6027\u80fd\u3002\u901a\u904e\u4e86\u89e3\u548c\u638c\u63e1\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5404\u9805\u53c3\u6578\uff0c\u4f7f\u7528\u8005\u53ef\u4ee5\u66f4\u6709\u6548\u5730\u7ba1\u7406\u548c\u904b\u884cZookeeper\u3002\u5728\u9078\u64c7\u5408\u9069\u7684<code><a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a><\/code>\u6216<code><a href=\"https:\/\/server.hk\">\u96f2\u4f3a\u670d\u5668<\/a><\/code>\u6642\uff0c\u78ba\u4fdd\u5176\u652f\u6301Zookeeper\u7684\u904b\u884c\u74b0\u5883\uff0c\u4ee5\u4fbf\u65bc\u66f4\u597d\u5730\u90e8\u7f72\u548c\u7ba1\u7406\u5206\u5e03<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22Zookeeper\u6578\u64da\u5eab\u914d\u7f6e\u6587\u4ef6\u7684\u5b8c\u6574\u6307\u5357\uff0c\u5b78\u7fd2\u5982\u4f55\u6b63\u78ba\u8a2d\u7f6e\u548c\u512a\u5316\u914d\u7f6e\u4ee5\u63d0\u5347\u7cfb\u7d71\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-148475","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/148475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=148475"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/148475\/revisions"}],"predecessor-version":[{"id":148476,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/148475\/revisions\/148476"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=148475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=148475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=148475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}