The ZooKeeper operations
ZooKeeper's data model and its API support the following nine basic operations:
Operation |
Description |
---|---|
|
Creates a znode in a specified path of the ZooKeeper namespace |
|
Deletes a znode from a specified path of the ZooKeeper namespace |
|
Checks if a znode exists in the path |
|
Gets a list of children of a znode |
|
Gets the data associated with a znode |
|
Sets/writes data into the data field of a znode |
|
Gets the ACL of a znode |
|
Sets the ACL in a znode |
|
Synchronizes a client's view of a znode with ZooKeeper |
Let's look at the ZooKeeper operations mentioned in the preceding table using ZooKeeper Java shell:
- Create a znode called root with
ThisIsTheRootNode
as its data:[zk: localhost(CONNECTED) 0] create /root "ThisIsTheRootNode" Created /root
- Get the content of the just created znode
root
:[zk: localhost(CONNECTED) 1] get /root "ThisIsTheRootNode" ...