4

Zookper document reads something like,

ZooKeeper also has the notion of ephemeral nodes. These znodes exists as long as the session that created the znode is active. When the session ends the znode is deleted. Ephemeral nodes are useful when you want to implement [tbd].

I understood the functionality but what could be the purpose or use case of session specific znode?

J. P
  • 356
  • 4
  • 20

2 Answers2

3

An ephemeral zNode is a node that will disappear when the session of its owner ends. A typical use case for ephemeral nodes is when using ZooKeeper for discovery of hosts in your distributed system (service discovery). Each server can then publish its IP address in an ephemeral node, and should a server loose connectivity with ZooKeeper and fail to reconnect within the session timeout, then its information is deleted.

Sources:

 - https://www.elastic.co/blog/found-zookeeper-king-of-coordination
 - https://blog.box.com/blog/a-gotcha-when-using-zookeeper-ephemeral-nodes
Anurag Sharma
  • 2,409
  • 2
  • 16
  • 34
2

Zookeeper leader election uses ephemeral nodes. Each node creates an ephemeral-sequential node and creates a watch on its previous ephemeral node and creates a linked list kind of structure. This article explains more in detail.

Kafka consumer (or consumer groups) offsets are also maintained in the ephemeral nodes. This article explains more in detail.

J. P
  • 356
  • 4
  • 20