Java ZooKeeper Tutorials
Installing Apache ZooKeeper
Download zookeeper-3.4.6.tar.gz
from Apache ZooKeeper Download Page, to install ZooKeeper just unzip the tar file:
$ tar xvf zookeeper-3.4.6.tar.gz
ZooKeeper Getting Started Guide is a good for get you started with ZooKeeper.
Connecting To ZooKeeper
org.apache.zookeeper.tutorials.ZooKeeperConnector demonstrate how java application connect to ZooKeeper.
org.apache.zookeeper.tutorials.TestZkConnection test ZooKeeper Connection, run it as java application will output all znode name, for example in my environment, the output like:
zookeeper
zk_test
Creating ZNode
org.apache.zookeeper.tutorials.CreateZNode show how to create znode, run it as java application will create znode /sampleznode
with data sample znode data
.
Updating ZNode
org.apache.zookeeper.tutorials.UpdateZNode show how to update znode, run it as java application will update znode /sampleznode
.
Reading ZNode Data
org.apache.zookeeper.tutorials.ReadZNode show how to read znode data, run it as java application will output the data under znode /sampleznode
.
Deleting Znode
org.apache.zookeeper.tutorials.DeleteZNode show how to delete a exist znode, run it as java application will delete znode /sampleznode
.