{"id":651,"date":"2022-09-05T18:35:59","date_gmt":"2022-09-05T10:35:59","guid":{"rendered":"https:\/\/program.snlcw.com\/?p=651"},"modified":"2022-09-12T19:17:12","modified_gmt":"2022-09-12T11:17:12","slug":"zookeeper-%e4%bc%9a%e8%af%9d","status":"publish","type":"post","link":"https:\/\/program.snlcw.com\/651.html","title":{"rendered":"Zookeeper \u4f1a\u8bdd"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/program.snlcw.com\/651.html\/#1_%E4%BC%9A%E8%AF%9DID%E3%80%81%E8%BF%9E%E6%8E%A5%E6%96%AD%E5%BC%80%E3%80%81%E8%BF%87%E6%9C%9F%E3%80%81%E8%B6%85%E6%97%B6%E6%A6%82%E5%BF%B5\" >1. \u4f1a\u8bddID\u3001\u8fde\u63a5\u65ad\u5f00\u3001\u8fc7\u671f\u3001\u8d85\u65f6\u6982\u5ff5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/program.snlcw.com\/651.html\/#2_%E4%BC%9A%E8%AF%9D%E8%B6%85%E6%97%B6%E6%8E%92%E6%9F%A5\" >2. \u4f1a\u8bdd\u8d85\u65f6\u6392\u67e5<\/a><\/li><\/ul><\/nav><\/div>\n<h1 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_%E4%BC%9A%E8%AF%9DID%E3%80%81%E8%BF%9E%E6%8E%A5%E6%96%AD%E5%BC%80%E3%80%81%E8%BF%87%E6%9C%9F%E3%80%81%E8%B6%85%E6%97%B6%E6%A6%82%E5%BF%B5\"><\/span>1. \u4f1a\u8bddID\u3001\u8fde\u63a5\u65ad\u5f00\u3001\u8fc7\u671f\u3001\u8d85\u65f6\u6982\u5ff5<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p>\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u7aef\u5efa\u7acb\u8fde\u63a5\u540e\uff0c\u4f1a\u751f\u6210 SessionId\uff0c\u5ba2\u6237\u7aef\u4f1a\u5b9a\u65f6\u5411\u670d\u52a1\u5668\u53d1\u9001\u5fc3\u8df3\u4ee5\u91cd\u7f6e\u4e0b\u6b21 SessionTimeout \u65f6\u95f4\u3002\u751f\u6210\u7684 SessionId \u5e94\u8be5\u662f\u5b58\u50a8\u5728\u78c1\u76d8\u4e0a\u7684\uff0c\u670d\u52a1\u5668\u6302\u4e86\u91cd\u542f\u8fd8\u4f1a\u5c1d\u8bd5\u4f7f\u7528\u540c\u4e00\u4e2a SessionId\u4e0e\u5ba2\u6237\u673a\u5efa\u7acb\u8fde\u63a5\u3002\u82e5\u662f\u5ba2\u6237\u7aef\u6302\u4e86\uff0c\u670d\u52a1\u5668\u4f7f\u7528 SessionId \u4f1a\u8fde\u4e0d\u4e0a\u5ba2\u6237\u7aef\uff0c\u6b64\u65f6 ZK \u65e5\u5fd7\u53ef\u80fd\u5c31\u4f1a\u62a5\u9519\uff1a<em>WARN Unable to read additional data from client sessionid 0x10058c12dc2017a, likely client has closed socket<\/em>\uff08\u53ea\u662f\u731c\u6d4b\u672a\u9a8c\u8bc1\uff0c\u4f46\u6bcf\u6b21\u5173\u95edZK\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\uff0c\u4e00\u91cd\u542f\u5c31\u62a5\u9519\u6b64\u9519\u8bef\uff0c\u53e6\u5916Session \u8d85\u65f6\u53ef\u80fd\u4e5f\u4f1a\u62a5\uff09<\/p>\n\n\n\n<p>\u82e5\u8fde\u63a5\u65ad\u5f00\uff0cZookeeper \u4f1a\u81ea\u5df1\u6309\u5982\u4e0b\u6d41\u7a0b\u81ea\u52a8\u5c1d\u8bd5\u7528\u540c\u4e00\u4e2a sessionId \u5efa\u7acb\u65b0\u8fde\u63a5\uff1a<br><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">\u6355\u83b7\u8fde\u63a5\u65ad\u5f00\u5f02\u5e38 -&gt;\u83b7\u53d6\u4e00\u4e2a\u65b0\u7684ZK\u5730\u5740 -&gt; \u5c1d\u8bd5\u8fde\u63a5<\/mark><\/em>\uff0c\u6240\u4ee5\u82e5\u53d1\u751f <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Connection Loss<\/mark> \u60c5\u51b5\uff0c\u5e94\u7528\u65e0\u9700\u505a\u4ec0\u4e48\uff0c\u7b49\u5f85ZK\u5ba2\u6237\u7aef\u5efa\u7acb\u65b0\u8fde\u63a5\u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u82e5\u53d1\u751f <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Session Expired<\/mark>\uff0c\u901a\u5e38\u662fZK\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u7684\u8fde\u63a5\u65ad\u4e86\uff0c\u91cd\u65b0\u8fde\u4e0a\u65b0\u7684ZK\u670d\u52a1\u5668\u53c8\u5f88\u6162\uff0c\u8d85\u8fc7\u4e86 Session Timeout \u6307\u5b9a\u7684\u65f6\u95f4\uff0c\u90a3\u4e48\u670d\u52a1\u5668\u8ba4\u4e3a\u8fd9\u4e2a Session \u5df2\u7ecf\u8fc7\u671f\u4e86\u3002\u7531\u4e8e\u5728ZK\u4e2d\uff0c\u5f88\u591a\u6570\u636e\u548c\u72b6\u6001\u90fd\u662f\u548c\u4f1a\u8bdd\u7ed1\u5b9a\u7684\uff0c\u4e00\u65e6\u4f1a\u8bdd\u5931\u6548\uff0c\u90a3\u4e48ZK\u5c31\u5f00\u59cb\u6e05\u9664\u548c\u8fd9\u4e2a\u4f1a\u8bdd\u6709\u5173\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u8fd9\u4e2a\u4f1a\u8bdd\u521b\u5efa\u7684\u4e34\u65f6\u8282\u70b9\u548c\u6ce8\u518c\u7684\u6240\u6709Watcher\u3002\u7f51\u7edc\u6062\u590d\u540e\uff0c\u5ba2\u6237\u7aef\u53ef\u80fd\u4f1a\u91cd\u65b0\u8fde\u63a5\u4e0a\u670d\u52a1\u5668\uff0c\u4f46\u662f\u5f88\u4e0d\u5e78\uff0c\u670d\u52a1\u5668\u4f1a\u544a\u8bc9\u5ba2\u6237\u7aef\u4e00\u4e2a\u5f02\u5e38\uff1a SessionExpired\u3002\u6b64\u65f6\u5ba2\u6237\u7aef\u7684\u72b6\u6001\u53d8\u6210 CLOSED\uff0c\u5e94\u7528\u9700\u8981\u81ea\u5df1\u7f16\u7801\u505a\u4e00\u4e9b\u989d\u5916\u7684\u5904\u7406\uff0c\u5b9e\u73b0\u91cd\u65b0\u5b9e\u4f8bzookeeper\u5bf9\u8c61\uff0c\u91cd\u65b0\u64cd\u4f5c\u6240\u6709\u4e34\u65f6\u6570\u636e\uff08\u5305\u62ec\u4e34\u65f6\u8282\u70b9\u548c\u6ce8\u518cWatcher\uff09\uff0c\u603b\u4e4b\uff0c\u4f1a\u8bdd\u8d85\u65f6\u5728ZK\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u662f\u771f\u5b9e\u5b58\u5728\u7684\u3002<\/p>\n\n\n\n<p>\u5ba2\u6237\u7aef\u5e76\u4e0d\u662f\u53ef\u4ee5\u968f\u610f\u8bbe\u7f6e\u4f1a\u8bdd\u8d85\u65f6\u65f6\u95f4\uff0cZK\u670d\u52a1\u5668\u7aef\u6709\u4e00\u4e2a\u6700\u5c0f\u3001\u6700\u5927\u7684\u9650\u5236\u8bbe\u7f6e\uff0c\u7531 <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">minSessionTimeout<\/mark> \u548c <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">maxSessionTimeout<\/mark> \u8fd9\u4e24\u4e2a\u53c2\u6570\u8bbe\u7f6e\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b minSessionTimeout \u503c\u7b49\u4e8e 2*tickTime \u5373\u4e24\u4e2a\u6ef4\u7b54\u58f0\uff0c maxSessionTimeout \u5219\u662f 20\u4e2a\u6ef4\u7b54\u58f0\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">tickTime<\/mark> \u9ed8\u8ba4\u503c\u662f 2000\uff08\u53732\u79d2\uff09\uff0c\u6240\u4ee5\u9ed8\u8ba4\u670d\u52a1\u5668\u7aef\u5141\u8bb8\u7684\u8d85\u65f6\u65f6\u95f4\u5728 4\u79d2~40\u79d2 \u4e4b\u95f4\uff0c\u56e0\u6b64\u50cf storm \u8fd9\u79cd\u5ba2\u6237\u7aef\u5e94\u7528\u6709\u4e2a\u914d\u7f6e\u53c2\u6570 <em>storm.zookeeper.session.timeout<\/em>\uff0c\u5b83\u7684\u503c\u5c31\u5fc5\u987b\u9650\u5236\u5728\u5176\u4e2d\uff0c\u9ed8\u8ba4\u503c\u662f 20\u79d2\u3002\u66f4\u591a ZK \u53c2\u6570\u8bf7\u770b<br><a href=\"https:\/\/zookeeper.apache.org\/doc\/r3.4.13\/zookeeperAdmin.html#sc_configuration\" target=\"_blank\" rel=\"noreferrer noopener\">\u5b98\u65b9\u6587\u6863<\/a>\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_%E4%BC%9A%E8%AF%9D%E8%B6%85%E6%97%B6%E6%8E%92%E6%9F%A5\"><\/span>2. \u4f1a\u8bdd\u8d85\u65f6\u6392\u67e5<span class=\"ez-toc-section-end\"><\/span><\/h1>\n\n\n\n<p>\u5de5\u4f5c\u4e2d\u4e00\u53f0\u534e\u4e3a\u4e3b\u5907\u5899\u6d41\u91cf\u7279\u522b\u5927\uff0c\u6bcf\u5206\u949f\u53d18\u4e07\u6761\u65e5\u5fd7\uff0c\u5e73\u5747\u6bcf\u79d21300\u6761\uff0c\u63a5\u8fc7\u6765\u540e\u5bfc\u81f4 supervisor \u4e00\u4f1a\u513f\u5c31\u6302\u4e86\uff0c\u6d4b\u8bd5\u73af\u5883\u6a21\u62df\u6bcf\u79d2\u53d12000\u6761\u6301\u7eed10\u5206\u949f\u5374\u6ca1\u91cd\u73b0\u5ba2\u6237\u95ee\u9898\uff0c\u53ea\u80fd\u901a\u8fc7\u65e5\u5fd7\u6392\u67e5\u4e86\u3002\u65e5\u5fd7\u4e2d\u5b58\u5728\u5927\u91cf WARN\uff0c\u6574\u7406\u51fa\u67654\u7c7b\uff1a<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\uff081\uff09\uff08ConnectionStateManager-0] [WARN] Session timeout has elapsed while SUSPENDED. Injecting a session expiration. Elapsed ms: 20009. Adjusted session timeout ms: 20000\uff09\n\n\uff082\uff09Client session timed out, have not heard from server in 16105ms for sessionid 0x..., closing socket connection and attempting reconnect\n\n\uff083\uff09[INFO] unable to reconnect to zookeeper service, session 0x... has expired, Closing socket connection.\n\n (4) [WARN] session expired event received<\/pre>\n\n\n\n<p>\u5f88\u660e\u663e\u8fd9\u4e9b\u90fd\u4e0e Zookeeper \u4f1a\u8bdd\u6709\u5173\uff0c\u56e0\u6b64\u6211\u5c06ZK\u670d\u52a1\u5668\u7684 tickTime \u589e\u52a0\u5230\u4e86 8000\uff0c\u53738\u79d2\uff0cminSessionTimeout \u548c maxSessionTimeout \u5219\u81ea\u52a8\u4f1a\u589e\u52a0\u5230 16\u79d2~160\u79d2 \u4e4b\u95f4\u3002\u63a5\u7740\u518d\u53bb storm.yaml \u4fee\u6539ZK\u5ba2\u6237\u7aef\u8d85\u65f6\u65f6\u95f4 <em>storm.zookeeper.session.timeout: 80000<\/em>\uff0880\u79d2\uff0c\u537310\u4e2a\u6ef4\u7b54\u58f0\uff09\uff0c\u5fc5\u987b\u572816\u79d2~160\u79d2 \u4e4b\u95f4\u3002<\/p>\n\n\n\n<p>\u6d4b\u4e0b\u6765\u53d1\u73b0\u5f00\u5934\u6253\u5370\u51fa\u7684\u65e5\u5fd7\u663e\u793a\u6b64\u914d\u7f6e\u662f\u751f\u6548\u7684\uff0c\u4f46\u540e\u9762\u7684\u65e5\u5fd7\u5374\u53c8\u56de\u5230\u4e86 20000\uff0c\u6709\u70b9\u5947\u602a\u3002\u540e\u6765\u6211\u662f\u76f4\u63a5\u901a\u8fc7\u6539ZK\u670d\u52a1\u5668\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">\u8bbe\u7f6e minSessionTimeout \u548c maxSessionTimeout \u90fd\u4e3a 80000<\/mark>\uff0c\u5373\u5ffd\u89c6\u5ba2\u6237\u7aef\u4efb\u4f55\u8bbe\u7f6e\uff0c\u5f3a\u5236\u4f7f\u7528ZK\u670d\u52a1\u5668\u914d\u7f6e\u624d\u641e\u5b9a\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u4f1a\u8bddID\u3001\u8fde\u63a5\u65ad\u5f00\u3001\u8fc7\u671f\u3001\u8d85\u65f6\u6982\u5ff5 \u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u7aef\u5efa\u7acb\u8fde\u63a5\u540e\uff0c\u4f1a\u751f\u6210 SessionId\uff0c\u5ba2\u6237\u7aef\u4f1a\u5b9a\u65f6\u2026 <span class=\"read-more\"><a href=\"https:\/\/program.snlcw.com\/651.html\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-651","post","type-post","status-publish","format-standard","hentry","category-zookeeper"],"_links":{"self":[{"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/posts\/651","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/comments?post=651"}],"version-history":[{"count":0,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/posts\/651\/revisions"}],"wp:attachment":[{"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/media?parent=651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/categories?post=651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/program.snlcw.com\/wp-json\/wp\/v2\/tags?post=651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}