9 Basic Zookeeper Terminology
Before going deeper into how ZooKeeper works, we should know some terms in ZooKeeper. Today, in this Zookeeper article, we are going to study the basic concepts or Terminology of ZooKeeper, in a nutshell, to better understand that it works properly.
So let’s start with Apache ZooKeeper Terminology. Zookeeper Terminology 9 Zookeeper Terminology: Zookeeper Basics Do you know why Zookeeper is so popular?
2. Zookeeper Terminology
Below, we cover the various terminology in Apache ZooKeeper:
A. Session In ZOOKEEPER operation, Session is very important. Basically in session requests are executed in FIFO order. However, a session will be created and a session id assigned to the client, as soon as the client connects to the server.
In addition, to keep the session valid, the client sends heartbeats at certain time intervals. There is a case where the ZooKeeper ensemble decides that a client dies when it does not receive a heartbeat from the client for more than the period, session timeout specified at the start of the service.
Although, usually session timeouts are represented in milliseconds. In addition, temporary znodes created during the session will also be deleted, when the session ends for any reason.
The watch is a simple mechanism, for clients to get notified about changes in the ZooKeeper ensemble. When reading a specific znode, the client can set the watch.
In addition, for any changes to the znode (where the client registers), the watch sends a notification to the registered client. With the existence of a znode or a derivative change of a Znode, the Znode change is a modification of the related data. However, only once, the watch is triggered. It has to be done via another read operation if the client wants any more notifications.
The client is disconnected from the server and the associated watch is also deleted when the connection session ends. Explore the Zookeeper App
In the ZooKeeper tree, each node is a znode. Basically, it maintains a stat structure. A Stat structure is a structure that contains version numbers for data changes, ACL changes, and more. So, Znodes maintains this change. The stat structure also has a timestamp.
The version number, along with the timestamp, allows ZooKeeper to validate cache and coordinate updates. The version number is incremented, every time the znode data changes.
For example, the client receives a version of the data, each time the client retrieves the data. Though, it should provide the converted version of Znode data, when the client performs an update or delete. Therefore, the update will fail, if the provided version does not match the actual data version.
D. Service Name
A service that maps a name to some information associated with that name, is called a name service. In addition, we may also extend name services to group membership services. Because with it it is possible to obtain information relating to the group to which the entity belongs, whose name we are looking for.
We may need to implement a distributed mutex, to allow serial access to shared resources in our distributed system. Therefore, with ZooKeeper, we can implement it easily.
Basically, to synchronize access to shared resources, we have to go hand in hand with a distributed mutex. However, ZooKeeper provides an interface that is simple to implement, whether implementing a producer-consumer queue or a barrier.
G. Configuration management
To store and manage the configuration of our distributed system centrally, we can use ZooKeeper. Learn ZooKeeper from the book ZooKeeper
H. Leader Election
It is possible that distributed systems may have to deal with the problem of dropping nodes. Additionally, we may wish to implement an automated fail-over strategy. For these types of issues, ZooKeeper offers direct support with leader selection.
I. ZooKeeper Access Control Using ACL
To control access to Znodes (data nodes from the ZooKeeper data tree), ZooKeeper uses ACLs. So, this is all in ZooKeeper Terminology.
Hope you like our explanation.