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?
1. Adjust the sessionTimeOut configuration of zookeeper cluster configuration
2. Implement heartbeat HeartBeatTime < SessionTimeOut
A few points.
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
Look at the timeout settings of the zk cluster
Check whether the time when the client actively disconnects matches the zk cluster
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.