{"id":3474,"date":"2018-12-02T20:50:17","date_gmt":"2018-12-02T12:50:17","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3474"},"modified":"2018-12-02T20:50:17","modified_gmt":"2018-12-02T12:50:17","slug":"java-zookeeper-%e5%ae%9e%e7%8e%b0%e4%b8%8d%e5%8f%af%e9%87%8d%e5%85%a5%e7%9a%84%e5%88%86%e5%b8%83%e5%bc%8f%e9%94%81","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3474","title":{"rendered":"Java + Zookeeper \u5b9e\u73b0\u4e0d\u53ef\u91cd\u5165\u7684\u5206\u5e03\u5f0f\u9501"},"content":{"rendered":"<p>\n\t\u770b\u8fc7\u6211\u535a\u5ba2\u7684\u7f51\u53cb\u90fd\u77e5\u9053\uff0c\u6211\u524d\u9762\u5199\u9501\u5199\u4e86\u975e\u5e38\u591a\u7684\u6587\u7ae0\u3002\u5305\u62ec\u60b2\u89c2\u9501\u3001\u4e50\u89c2\u9501\u3001\u81ea\u65cb\u9501\u3001\u9002\u5e94\u6027\u81ea\u65cb\u9501\u3001\u65e0\u9501\u3001\u504f\u5411\u9501\u3001\u8f7b\u91cf\u7ea7\u9501\u3001\u91cd\u91cf\u7ea7\u9501\u3001\u516c\u5e73\u9501\u3001\u975e\u516c\u5e73\u9501\u3001\u53ef\u91cd\u5165\u9501\u3001\u975e\u53ef\u91cd\u5165\u9501\u3001\u72ec\u4eab\u9501\u3001\u5171\u4eab\u9501\u7b49\u3002\u672c\u6587\u6211\u4eec\u501f\u52a9 Zookeeper \u5b9e\u73b0\u4e00\u4e2a\u4e0d\u53ef\u91cd\u5165\u7684\u5206\u5e03\u5f0f\u9501\uff01\n<\/p>\n<p>\n\t\u524d\u9762\u6587\u7ae0\u63a8\u8350\uff1a\n<\/p>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/www.xttblog.com\/?p=3377\">\u5b66\u4f1a Java \u4e2d\u7684\u9501\uff0c\u4f60\u53ea\u9700\u8981\u8bb0\u4f4f 6 \u53e5\u6cd5\u5219\u5373\u53ef\uff01<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.xttblog.com\/?p=3404\">\u4ece ReentrantReadWriteLock \u8bf4\u72ec\u4eab\u9501(\u6392\u4ed6\u9501)\u4e0e\u5171\u4eab\u9501<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.xttblog.com\/?p=3402\">\u56fe\u89e3 Java \u4e2d\u7684\u53ef\u91cd\u5165\u9501\u4e0e\u975e\u53ef\u91cd\u5165\u9501<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.xttblog.com\/?p=3400\">\u56fe\u89e3 Java \u4e2d\u7684\u516c\u5e73\u9501\u4e0e\u975e\u516c\u5e73\u9501<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.xttblog.com\/?p=3053\" title=\"InnoDB \u7684 select \u884c\u9501\u8fd8\u662f\u8868\u9501 - \u4e1a\u4f59\u8349\">InnoDB \u7684 select \u884c\u9501\u8fd8\u662f\u8868\u9501<\/a>\n\t<\/li>\n<\/ul>\n<p>\n\t\u5173\u4e8e\u9501\u7684\u6587\u7ae0\u8fd8\u6709\u5f88\u591a\uff0c\u6211\u5c31\u5148\u8d34\u51fa\u4e0a\u9762\u7684 5 \u4e2a\u3002\n<\/p>\n<p>\n\t\u5206\u5e03\u5f0f\u9501\u5bf9 Java \u7684 JUC \u5305\u6765\u8bf4\u5c31\u663e\u5f97\u65e0\u80fd\u4e3a\u529b\u4e86\u3002\u6240\u4ee5\u6211\u4eec\u8981\u501f\u52a9 Zookeeper \u7684\u6700\u5c0f\u7248\u672c\uff0cRedis \u7684 set \u51fd\u6570\uff0c\u6570\u636e\u5e93\u9501\u6765\u5b9e\u73b0\u5206\u5e03\u5f0f\u9501\u3002\n<\/p>\n<p>\n\t\u6211\u4eec\u77e5\u9053\u5728 Zookeeper \u4e2d\u662f\u4f7f\u7528\u6587\u4ef6\u76ee\u5f55\u7684\u683c\u5f0f\u5b58\u653e\u8282\u70b9\u5185\u5bb9\uff0c\u5176\u4e2d\u8282\u70b9\u7c7b\u578b\u5206\u4e3a\uff1a\n<\/p>\n<ul>\n<li>\n\t\t\u6301\u4e45\u8282\u70b9\uff08PERSISTENT \uff09\uff1a\u8282\u70b9\u521b\u5efa\u540e\uff0c\u4e00\u76f4\u5b58\u5728\uff0c\u76f4\u5230\u4e3b\u52a8\u5220\u9664\u4e86\u8be5\u8282\u70b9\u3002\n\t<\/li>\n<li>\n\t\t\u4e34\u65f6\u8282\u70b9\uff08EPHEMERAL\uff09\uff1a\u751f\u547d\u5468\u671f\u548c\u5ba2\u6237\u7aef\u4f1a\u8bdd\u7ed1\u5b9a\uff0c\u4e00\u65e6\u5ba2\u6237\u7aef\u4f1a\u8bdd\u5931\u6548\uff0c\u8fd9\u4e2a\u8282\u70b9\u5c31\u4f1a\u81ea\u52a8\u5220\u9664\u3002\n\t<\/li>\n<li>\n\t\t\u5e8f\u5217\u8282\u70b9\uff08SEQUENTIAL \uff09\uff1a\u591a\u4e2a\u7ebf\u7a0b\u521b\u5efa\u540c\u4e00\u4e2a\u987a\u5e8f\u8282\u70b9\u65f6\u5019\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u4f1a\u5f97\u5230\u4e00\u4e2a\u5e26\u6709\u7f16\u53f7\u7684\u8282\u70b9\uff0c\u8282\u70b9\u7f16\u53f7\u662f\u9012\u589e\u4e0d\u91cd\u590d\u7684\uff0c\u5982\u4e0b\u56fe\uff1a\n\t<\/li>\n<\/ul>\n<p>\n\t<img decoding=\"async\" alt=\"zk \u5b9e\u73b0\u5206\u5e03\u5f0f\u9501\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/zk-lock-2018-distributed.png\" \/>\n<\/p>\n<p>\n\t\u5982\u4e0a\u56fe\uff0c\u4e09\u4e2a\u7ebf\u7a0b\u5206\u522b\u521b\u5efa\u8def\u5f84\u4e3a \/root\/node \u7684\u8282\u70b9\uff0c\u53ef\u77e5\u5728 zk \u670d\u52a1\u5668\u7aef\u4f1a\u5728 root \u4e0b\u5b58\u5728\u4e09\u4e2a node \u8282\u70b9\uff0c\u5e76\u4e14\u7ebf\u7a0b\u7f16\u53f7\u662f\u552f\u4e00\u9012\u589e\u3002\n<\/p>\n<p>\n\t\u5177\u4f53\u5728\u8282\u70b9\u521b\u5efa\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u6df7\u5408\u4f7f\u7528\uff0c\u6bd4\u5982\u4e34\u65f6\u987a\u5e8f\u8282\u70b9\uff08EPHEMERAL_SEQUENTIAL\uff09\uff0c\u672c\u6587\u6211\u4eec\u5c31\u4f7f\u7528\u4e34\u65f6\u987a\u5e8f\u8282\u70b9\u6765\u5b9e\u73b0\u5206\u5e03\u5f0f\u9501\u3002\n<\/p>\n<p>\n\t\u5148\u8bf4\u4e00\u4e0b\u5b9e\u73b0\u539f\u7406\uff1a\n<\/p>\n<p>\n\t\u521b\u5efa\u4e34\u65f6\u987a\u5e8f\u8282\u70b9,\u6bd4\u5982 \/root\/node\uff0c\u5047\u8bbe\u8fd4\u56de\u7ed3\u679c\u4e3a nodeId\u3002\n<\/p>\n<p>\n\t\u83b7\u53d6 \/root \u4e0b\u6240\u6709\u5b69\u5b50\u8282\u70b9\uff0c\u7528\u81ea\u5df1\u521b\u5efa\u7684 nodeId \u7684\u5e8f\u53f7\u4e0e\u6240\u6709\u5b50\u8282\u70b9\u6bd4\u8f83\uff0c\u770b\u770b\u81ea\u5df1\u662f\u4e0d\u662f\u7f16\u53f7\u6700\u5c0f\u7684\u3002\u5982\u679c\u662f\u6700\u5c0f\u7684\u5219\u5c31\u76f8\u5f53\u4e8e\u83b7\u53d6\u5230\u4e86\u9501\uff0c\u5982\u679c\u81ea\u5df1\u4e0d\u662f\u6700\u5c0f\u7684\uff0c\u5219\u4ece\u6240\u6709\u5b50\u8282\u70b9\u91cc\u9762\u83b7\u53d6\u6bd4\u81ea\u5df1\u6b21\u5c0f\u7684\u4e00\u4e2a\u8282\u70b9\uff0c\u7136\u540e\u8bbe\u7f6e\u76d1\u542c\u8be5\u8282\u70b9\u7684\u4e8b\u4ef6\uff0c\u7136\u540e\u6302\u8d77\u5f53\u524d\u7ebf\u7a0b\u3002\n<\/p>\n<p>\n\t\u5f53\u6700\u5c0f\u7f16\u53f7\u7684\u7ebf\u7a0b\u83b7\u53d6\u9501\uff0c\u5904\u7406\u5b8c\u4e1a\u52a1\u540e\u5220\u9664\u81ea\u5df1\u5bf9\u5e94\u7684 nodeId\uff0c\u5220\u9664\u540e\u4f1a\u6fc0\u6d3b\u6bd4\u81ea\u5df1\u5927\u4e00\u53f7\u7684\u8282\u70b9\u7684\u7ebf\u7a0b\u4ece\u963b\u585e\u53d8\u4e3a\u8fd0\u884c\u6001\uff0c\u88ab\u6fc0\u6d3b\u7684\u7ebf\u7a0b\u5e94\u8be5\u5c31\u662f\u5f53\u524d node \u5e8f\u5217\u53f7\u6700\u5c0f\u7684\u4e86\uff0c\u7136\u540e\u5c31\u4f1a\u83b7\u53d6\u5230\u9501\u3002\n<\/p>\n<p>\n\t\u660e\u767d\u539f\u7406\u540e\uff0c\u4ee3\u7801\u5199\u8d77\u6765\u5c31\u975e\u5e38\u7684\u7b80\u5355\u4e86\u3002\n<\/p>\n<pre class=\"brush:java;\">\r\npublic class ZookeeperDistributedLock {\r\n    public final static Joiner j = Joiner.on(&quot;|&quot;).useForNull(&quot;&quot;);\r\n    \/\/zk\u5ba2\u6237\u7aef\r\n    private ZooKeeper zk;\r\n    \/\/zk\u662f\u4e00\u4e2a\u76ee\u5f55\u7ed3\u6784\uff0croot\u4e3a\u6700\u5916\u5c42\u76ee\u5f55\r\n    private String root = &quot;\/locks&quot;;\r\n    \/\/\u9501\u7684\u540d\u79f0\r\n    private String lockName;\r\n    \/\/\u5f53\u524d\u7ebf\u7a0b\u521b\u5efa\u7684\u5e8f\u5217node\r\n    private ThreadLocal&lt;String&gt; nodeId = new ThreadLocal&lt;&gt;();\r\n    \/\/\u7528\u6765\u540c\u6b65\u7b49\u5f85zkclient\u94fe\u63a5\u5230\u4e86\u670d\u52a1\u7aef\r\n    private CountDownLatch connectedSignal = new CountDownLatch(1);\r\n    private final static int sessionTimeout = 3000;\r\n    private final static byte[] data= new byte[0];\r\n    public ZookeeperDistributedLock(String config, String lockName) {\r\n        this.lockName = lockName;\r\n        try {\r\n            zk = new ZooKeeper(config, sessionTimeout, new Watcher() {\r\n                @Override\r\n                public void process(WatchedEvent event) {\r\n                    \/\/ \u5efa\u7acb\u8fde\u63a5\r\n                    if (event.getState() == KeeperState.SyncConnected) {\r\n                        connectedSignal.countDown();\r\n                    }\r\n                }\r\n\r\n            });\r\n            connectedSignal.await();\r\n            Stat stat = zk.exists(root, false);\r\n            if (null == stat) {\r\n                \/\/ \u521b\u5efa\u6839\u8282\u70b9\r\n                zk.create(root, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);\r\n            }\r\n        } catch (Exception e) {\r\n            throw new RuntimeException(e);\r\n        }\r\n    }\r\n    class LockWatcher implements Watcher {\r\n        private CountDownLatch latch = null;\r\n\r\n        public LockWatcher(CountDownLatch latch) {\r\n            this.latch = latch;\r\n        }\r\n        @Override\r\n        public void process(WatchedEvent event) {\r\n\r\n            if (event.getType() == Event.EventType.NodeDeleted)\r\n                latch.countDown();\r\n        }\r\n    }\r\n    public void lock() {\r\n        try {\r\n            \/\/ \u521b\u5efa\u4e34\u65f6\u5b50\u8282\u70b9\r\n            String myNode = zk.create(root + &quot;\/&quot; + lockName , data, ZooDefs.Ids.OPEN_ACL_UNSAFE,\r\n                    CreateMode.EPHEMERAL_SEQUENTIAL);\r\n            System.out.println(j.join(Thread.currentThread().getName() + myNode, &quot;created&quot;));\r\n            \/\/ \u53d6\u51fa\u6240\u6709\u5b50\u8282\u70b9\r\n            List&lt;String&gt; subNodes = zk.getChildren(root, false);\r\n            TreeSet&lt;String&gt; sortedNodes = new TreeSet&lt;&gt;();\r\n            for(String node :subNodes) {\r\n                sortedNodes.add(root +&quot;\/&quot; +node);\r\n            }\r\n            String smallNode = sortedNodes.first();\r\n            String preNode = sortedNodes.lower(myNode);\r\n            if (myNode.equals( smallNode)) {\r\n                \/\/ \u5982\u679c\u662f\u6700\u5c0f\u7684\u8282\u70b9,\u5219\u8868\u793a\u53d6\u5f97\u9501\r\n                System.out.println(j.join(Thread.currentThread().getName(), myNode, &quot;get lock&quot;));\r\n                this.nodeId.set(myNode);\r\n                return;\r\n            }\r\n            CountDownLatch latch = new CountDownLatch(1);\r\n            Stat stat = zk.exists(preNode, new LockWatcher(latch));\/\/ \u540c\u65f6\u6ce8\u518c\u76d1\u542c\u3002\r\n            \/\/ \u5224\u65ad\u6bd4\u81ea\u5df1\u5c0f\u4e00\u4e2a\u6570\u7684\u8282\u70b9\u662f\u5426\u5b58\u5728,\u5982\u679c\u4e0d\u5b58\u5728\u5219\u65e0\u9700\u7b49\u5f85\u9501,\u540c\u65f6\u6ce8\u518c\u76d1\u542c\r\n            if (stat != null) {\r\n                System.out.println(j.join(Thread.currentThread().getName(), myNode,\r\n                        &quot; waiting for &quot; + root + &quot;\/&quot; + preNode + &quot; released lock&quot;));\r\n                latch.await();\/\/ \u7b49\u5f85\uff0c\u8fd9\u91cc\u5e94\u8be5\u4e00\u76f4\u7b49\u5f85\u5176\u4ed6\u7ebf\u7a0b\u91ca\u653e\u9501\r\n                nodeId.set(myNode);\r\n                latch = null;\r\n            }\r\n        } catch (Exception e) {\r\n            throw new RuntimeException(e);\r\n        }\r\n\r\n    }\r\n    public void unlock() {\r\n        try {\r\n            System.out.println(j.join(Thread.currentThread().getName(), nodeId.get(), &quot;unlock &quot;));\r\n            if (null != nodeId) {\r\n                zk.delete(nodeId.get(), -1);\r\n            }\r\n            nodeId.remove();\r\n        } catch (InterruptedException e) {\r\n            e.printStackTrace();\r\n        } catch (KeeperException e) {\r\n            e.printStackTrace();\r\n        }\r\n    }\r\n}<\/pre>\n<p>\n\tZookeeperDistributedLock \u7684\u6784\u9020\u51fd\u6570\u521b\u5efa zkclient\uff0c\u5e76\u4e14\u6ce8\u518c\u4e86\u76d1\u542c\u4e8b\u4ef6\uff0c\u7136\u540e\u8c03\u7528 connectedSignal.await() \u6302\u8d77\u5f53\u524d\u7ebf\u7a0b\u3002\u5f53 zkclient \u94fe\u63a5\u5230\u670d\u52a1\u5668\u540e\uff0c\u4f1a\u7ed9\u76d1\u542c\u5668\u53d1\u9001 SyncConnected \u4e8b\u4ef6\uff0c\u76d1\u542c\u5668\u5224\u65ad\u5f53\u524d\u94fe\u63a5\u5df2\u7ecf\u5efa\u7acb\u4e86\uff0c\u5219\u8c03\u7528 connectedSignal.countDown(); \u6fc0\u6d3b\u5f53\u524d\u7ebf\u7a0b\uff0c\u7136\u540e\u521b\u5efa root \u8282\u70b9\u3002\n<\/p>\n<p>\n\t\u83b7\u53d6\u9501\u7684\u65b9\u6cd5 lock\uff0c\u5185\u90e8\u9996\u5148\u521b\u5efa \/root\/lockName \u7684\u987a\u5e8f\u4e34\u65f6\u8282\u70b9\uff0c\u7136\u540e\u83b7\u53d6 \/root \u4e0b\u6240\u6709\u7684\u5b69\u5b50\u8282\u70b9\uff0c\u5e76\u5bf9\u5b50\u8282\u70b9\u8fdb\u884c\u6392\u5e8f\uff0c\u7136\u540e\u5224\u65ad\u81ea\u5df1\u662f\u4e0d\u662f\u6700\u5c0f\u7684\u7f16\u53f7\uff0c\u5982\u679c\u662f\u76f4\u63a5\u8fd4\u56de true \u6807\u793a\u83b7\u53d6\u9501\u6210\u529f\u3002\u5426\u8005\u770b\u6bd4\u81ea\u5df1\u5c0f\u4e00\u4e2a\u53f7\u7684\u8282\u70b9\u662f\u5426\u5b58\u5728\uff0c\u5b58\u5728\u5219\u6ce8\u518c\u8be5\u8282\u70b9\u7684\u4e8b\u4ef6\uff0c\u7136\u540e\u6302\u8d77\u5f53\u524d\u7ebf\u7a0b\uff0c\u7b49\u5f85\u6bd4\u81ea\u5df1\u5c0f\u4e00\u4e2a\u6570\u7684\u8282\u70b9\u91ca\u653e\u9501\u540e\u53d1\u9001\u8282\u70b9\u5220\u9664\u4e8b\u4ef6\uff0c\u4e8b\u4ef6\u91cc\u9762\u6fc0\u6d3b\u5f53\u524d\u7ebf\u7a0b\u3002\n<\/p>\n<p>\n\t\u91ca\u653e\u9501\u7684\u65b9\u6cd5 unlock \u6bd4\u8f83\u7b80\u5355\uff0c\u5c31\u662f\u7b80\u5355\u7684\u5220\u9664\u83b7\u53d6\u9501\u65f6\u5019\u521b\u5efa\u7684\u8282\u70b9\u3002\n<\/p>\n<p>\n\tZookeeper \u975e\u5e38\u7684\u5f3a\u5927\uff0c\u5f53\u4f60\u771f\u6b63\u7684\u4e86\u89e3\u540e\uff0c\u4f60\u4f1a\u53d1\u73b0\u5b83\u80fd\u505a\u5f88\u591a\u4e8b\u60c5\u3002\n<\/p>\n<p>\n\t\u5149\u5206\u5e03\u9501\u65b9\u9762\uff0c\u5b83\u90fd\u80fd\u5e2e\u52a9\u6211\u4eec\u5b9e\u73b0\u597d\u51e0\u79cd\uff0c\u5982\u4e0b\u9762\u6211\u5217\u4e3e\u7684\u8fd9\u4e9b\uff1a\n<\/p>\n<ul>\n<li>\n\t\t\u53ef\u91cd\u5165\u9501Shared Reentrant Lock\n\t<\/li>\n<li>\n\t\t\u4e0d\u53ef\u91cd\u5165\u9501Shared Lock\n\t<\/li>\n<li>\n\t\t\u53ef\u91cd\u5165\u8bfb\u5199\u9501Shared Reentrant Read Write Lock\n\t<\/li>\n<li>\n\t\t\u4fe1\u53f7\u91cfShared Semaphore\n\t<\/li>\n<li>\n\t\t\u591a\u9501\u5bf9\u8c61 Multi Shared Lock\n\t<\/li>\n<\/ul>\n<p>\n\t\u5176\u5b9e\u672c\u6587\u6240\u89e3\u91ca\u7684\u8fd9\u4e2a\u5206\u5e03\u5f0f\u9501\uff0c\u8fd8\u53ef\u4ee5\u5728\u8fdb\u4e00\u6b65\u7684\u4f18\u5316\u4f18\u5316\u3002\u5177\u4f53\u600e\u4e48\u4f18\u5316\uff0c\u5927\u5bb6\u53ef\u4ee5\u601d\u8003\u4e00\u4e0b\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3474\">Java + Zookeeper \u5b9e\u73b0\u4e0d\u53ef\u91cd\u5165\u7684\u5206\u5e03\u5f0f\u9501<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u770b\u8fc7\u6211\u535a\u5ba2\u7684\u7f51\u53cb\u90fd\u77e5\u9053\uff0c\u6211\u524d\u9762\u5199\u9501\u5199\u4e86\u975e\u5e38\u591a\u7684\u6587\u7ae0\u3002\u5305\u62ec\u60b2\u89c2\u9501\u3001\u4e50\u89c2\u9501\u3001\u81ea\u65cb\u9501\u3001\u9002\u5e94\u6027\u81ea\u65cb\u9501\u3001\u65e0\u9501\u3001\u504f\u5411\u9501\u3001\u8f7b [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[761,480,762,1694,76],"class_list":["post-3474","post","type-post","status-publish","format-standard","hentry","category-java","tag-zookeeper","tag-762","tag-1694","tag-76"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3474","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3474"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3474\/revisions"}],"predecessor-version":[{"id":3475,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3474\/revisions\/3475"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}