vertx-zookeeper
vertx-zookeeper copied to clipboard
nodeID cann't config when use Json
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());
}
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"}'
}
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.....
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.
@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
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()); }
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