Having 3 zookeeper in 3 machines with one kafka broker in each zookeeper. number of host : 3 number of znodes to be tracked : 1 [1* number of hosts = 3] Is there any way to track the hostname&znode with Zookeeper.Stat class variables when znode changes its state [caseOk/NoNode]. Trying to implement a counter to track alive znode on multiple host Ports. Straggling at a point to identify first znode exists instance and reconnecting instance.
1
There are 1 best solutions below
Related Questions in APACHE-ZOOKEEPER
- Changing kafka zookeeper.connect by adding chroot
- Suppress Log4j Output from org.apache.zookeeper.ZooKeeper
- Using Kazoo to interact with a ZK cluster
- Zookeeper timeout when upgrade flink 1.14 to 1.18
- Docker-compose Kafka: no brokers available
- Why I'm getting this error when implementing SSL security in zookeeper(kafka) and connecting using zookeeper-shell.sh - PKIX path building failed?
- Keeper Clickhouse Replication DDL on cluster, but no replication data, error "Table was in readonly mode"
- zkcli upconfig by using java service
- Error while running the zookeeper command on windows machine
- HBase Zookeeper Connection Error Docker Standalone 2.3.x and 2.4.x
- can't to start clickhouse service after restart
- The system cannot find the path specified. Unable to start Zookeeper
- Zookeeper integration with .Net c# getting error while fetching node
- log4j properties doesn't apply after upgrading zookeeper from 3.6.3 to 3.9.1
- kafka controllers + root cause of re-elect in worse case scenario
Related Questions in ZNODES
- Using go-zookeeper api to create TTL Node always shows invalid arguments
- zookeeper: how to delete id from ACL?
- Java Zookeeper API weird ZNode behavior. Unable to delete ZNode properly. It has unexpected results
- HBase: The table test does not exist in meta but has a znode. run hbck to fix inconsistencies (which fails)
- Can we give the path of text files as data in zookeeper znodes?
- Zookeeper Node vs. zNode
- Zookeeper znode count
- Zookeeper znode watch counter
- ZkException: Unable to connect to zNode01:2181
- How to get znode ip
- Expiration of zookeeper persistent node
- Get all subnode keys and values from zookeeper
- ERROR org.apache.zookeeper.ClientCnxn - Error while calling watcher
- Producer Consumer queue in zookeeper
- Streaming data into hbase 0.98.1 using flume 1.4 wiith a custom sink
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
There's a small ambiguity in your question. I assume that you have 3 separate Zookeeper nodes (standalone or 3 separate ensembles) and want to watch the same ZNode at
/some/pathin all 3 Zookeeper nodes.(If you are referring to a single ensemble with 3 nodes, then you don't have to worry about the nodes as the ensemble will guarantee consistency over the nodes in the ensemble)
The easiest way is to use Apache Curator recipe (see recipes), NodeCache. Apache Curator is a set of recipes and an extension to the standard ZookeeperClient. It manage all the edge cases and connection states internally so that yo don't have to worry about difficulties in pure Zookeeper client. A NodeCache can watch a given ZNode (at a given ZPath) and notify changes happening to that ZNode.
See this answer to understand how to initialize a CuratorFramework instance.
All you have to do is initializing 3 CuratorFramework instances with 3 connection strings (for your 3 nodes) as described in the above answer and then starting the NodeCache objects for each client.
Then start all of those clients,
Finally, create and start NodeCache instances for the ZNode for each CuratorFramework instance.
Then add NodeCacheListener for each node cache to subscribe for ZNode changes.
Then, start them.
Now, you will receive any change happen through the listeners you registered. Hope you got the idea.