How to programmatically detect which server in ensemble client is connected to?
问题 How to programmatically detect which server in a ZooKeeper ensemble a client is connected to? I'm using the Apache Curator API and I am listening for state changes in connection by registering ConnectionStateListener. I would like to know which server in the ensemble a client is connected to when the client reconnects if the server it was connected to goes down. 回答1: You can see this in the logs produced by Curator. In the example output below, the CuratorFramework client has been given 4