vertx-zookeeper icon indicating copy to clipboard operation
vertx-zookeeper copied to clipboard

nodeID cann't config when use Json

Open takeseem opened this issue 7 years ago • 5 comments

in join method nodeID = UUID.randomUUID().toString(), i think it is better in the conscutor. Example:

  public ZookeeperClusterManager(JsonObject config) {
    this.conf = config;
    this.nodeID = config.getString("nodeID", UUID.randomUUID().toString());
  }

ZookeeperClusterManager.nodeId

takeseem avatar Jul 26 '17 04:07 takeseem

my mind is: nodeID: include my application id, ip and pid. or nodeData: will be set zookeeper node data path /io.vertx/cluster/nodes/mynode-uuid

when I monitor zookeeper, I can fast found my application by node's name or node's data

{
  nodeID: 'account-center#ip#pid#uuid',
  nodeData: '{appId: "account-center", ip: "192.168.1.2", pid: "1123"}'
}

takeseem avatar Jul 26 '17 04:07 takeseem

Hi @takeseem, I resolved my issue by creating CustomZookeeperClusterManager class by extending ZookeeperClusterManager, it relies on unique node id passed from command line... I have attached code for you.

cmd options

-Dvertx.cluster.managerClass=<package path>.CustomZookeeperClusterManager 
-Dvertx.zookeeper.node=<node_name>

Hoping that it will help you.....

nabhosal avatar Jul 26 '17 09:07 nabhosal

nodeID be managed by vertx-zk-cluster, it can not be passed with config. I am not sure it's good idea that assign nodeID with user.

stream-iori avatar Jul 28 '17 06:07 stream-iori

@stream1984 , We do agree its not a good idea to take nodeID from users. But, consider a deployment having a large number of service running then it becomes difficult for dev-ops to track which service is down even though we use zk watcher since UUID are non-intuitive. We faced this issue in initial days, and we resolve by creating unique intuitive nodeIds. Refer this fork, we are using this in our production https://github.com/nabhosal/vertx-zookeeper

nabhosal avatar Sep 13 '19 12:09 nabhosal

in join method nodeID = UUID.randomUUID().toString(), i think it is better in the conscutor. Example:

  public ZookeeperClusterManager(JsonObject config) {
    this.conf = config;
    this.nodeID = config.getString("nodeID", UUID.randomUUID().toString());
  }

ZookeeperClusterManager.nodeId

After zk is disconnected, the cluster node needs to be re-registered, but the nodeId in this join method is generated using UUID, so there is no way to re-register to zk

jinke007 avatar Jan 19 '21 08:01 jinke007