zoukankan      html  css  js  c++  java
  • zk的KeeperErrorCode = ConnectionLoss错误

    额,这东西都快把人搞崩溃了,各种排查各种正常。

    最后竟然是因为我在客户端未连接上zkserver的时候就进行了create操作造成的错误。

    噗, 

    Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /servers/server
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
        at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:778)
        at com.example.test.zk.DistributeServer.registerServer(DistributeServer.java:44)
        at com.example.test.zk.DistributeServer.main(DistributeServer.java:66)

    上面这样的错误,在我随便加了一个sleep操作,之后就正常了。

    如下:

    //        Thread.sleep(10000);
            String create = zk.create(parentNode + "/server", hostname.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL_SEQUENTIAL);
            System.out.println(hostname + "is online.." + create);

    哎, 贼耽误工夫。

  • 相关阅读:
    D
    NOI 1.7编程基础之字符串(35题)
    HYSBZ 2145 悄悄话
    POJ 2406 Power Strings
    POJ 3461 Oulipo[附KMP算法详细流程讲解]
    POJ 3974 Palindrome
    POJ 1002 487-3279
    POJ 1182 食物链
    POJ 2524 Ubiquitous Religions
    HDU 1251 统计难题
  • 原文地址:https://www.cnblogs.com/goblinn/p/9467761.html
Copyright © 2011-2022 走看看