Apache ZooKeeper

11 / 48

ZooKeeper - Data Model - Znode

Not able to play video? Try with youtube

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

== Types of Znodes - Persistent == Such kind of znodes remain in zookeeper until 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 - Ephemeral == Ephemeral 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 ephemeral node can not have children not even ephemeral 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.

Loading comments...