Apache ZooKeeper

13 / 47
ZooKeeper - Data Model - Znode

== Types of Znodes == There are three types of znodes or nodes: Persistent, Ephermal and Sequential.

== Types of Znodes - Persistent == Such kind of znodes remain in zookeeper untill deleted. This is the default type of znode. To create such node you can use the command: create /name_of_myznode "mydata"

== Types of Znodes - Ephermal == Ephermal node gets deleted if the session in which the node was created has disconnected. Though it is tied to client's session but it is visible to the other users.

An ephermal node can not have children not even ephermal children.

== Types of Znodes - Sequential == Quite often, we need to create sequential numbers such ids. In such situations we use sequential nodes.

Sequential znode are created with number appended to the provided name.

You can create a znode by using create -s. The following command would create a node with a zoo followed by a number: create -s /zoo v

This number keeps increasing monotonically on every node creation inside a particular node. The first sequential child node gets a suffix of 0000000000 for any node.