search

Home  >  Q&A  >  body text

java - zookeeper always disconnects and reconnects?

Deploy zookeeper on the spring boot project to register the service. It was normal at first. However, it will be disconnected and reconnected after a while, connected, and disconnected again. . The final result reported was that the reconnection failed.
Do you want to set the session time? I set a longer time, and it did not disconnect at first, but after a while, it disconnected and reconnected. . .
Can anyone help me?

我想大声告诉你我想大声告诉你2727 days ago1244

reply all(2)I'll reply

  • 迷茫

    迷茫2017-07-03 11:45:21

    1. Adjust the sessionTimeOut configuration of zookeeper cluster configuration
    2. Implement heartbeat HeartBeatTime < SessionTimeOut

    reply
    0
  • PHP中文网

    PHP中文网2017-07-03 11:45:21

    A few points.

    1. Confirm whether there are any problems with the network between the machine and the zk cluster. If the network is disconnected frequently, no matter how you deal with it, it will be ineffective

    2. Look at the timeout settings of the zk cluster

    3. Check whether the time when the client actively disconnects matches the zk cluster

    4. I have never been exposed to the native zk client. . I don’t know how to ensure the session heartbeat. You need to check the way your zk client heartbeat is kept alive to see if the heartbeat is not sent for a long time, causing zk to think that the client is dead and actively disconnect.

    reply
    0
  • Cancelreply