9 Zookeeper Terminologies: Basics of Zookeeper
1. Objective – Terms in ZooKeeper
As we have already seen the introduction of Apache Zookeeper. So, before going more deeper into the working of ZooKeeper, we must know some terminologies in ZooKeeper. Today, in this Zookeeper article, we will learn the fundamental concepts or ZooKeeper Terminologies, in brief, to further understand it’s working well.
So, let’s start Apache ZooKeeper Terminologies.
2. Zookeeper Terminologies
Below, we are discussing various terminologies in Apache ZooKeeper:
In ZOOKEEPER operations, Sessions are very important. Basically in a session requests executes in FIFO order. However, the session will be established and a session id is assigned to the client, as soon as the client connects to a server.
Moreover, to keep the session valid, the client sends heartbeats at a particular time interval. There is a case that in which ZooKeeper ensemble decides that the client died when it does not receive heartbeats from a client for more than the period, session timeout which is specified at the starting of the service.
Although, usually Session timeouts are represented in milliseconds. Also, the ephemeral znodes created during that session also get deleted, when a session ends for any reason.
Watches are a simple mechanism, for the client to get notifications about the changes in the ZooKeeper ensemble. While reading a particular znode, clients can set watches. Moreover, for any of the znode (on which client registers) changes, watches send a notification to the registered client.
With the znode or changes in the Znode’s children, Znode changes are a modification of data associated. However, only once, watches are triggered. It must be done through another read operation if a client wants a notification again. The client will be disconnected from the server and the associated watches are also removed when a connection session is expired.
Explore ZooKeeper Applications
In a ZooKeeper tree, every node is a znode. Basically, it maintains a stat structure. Stat Structure is a structure which contains version numbers for data changes, ACL changes and many more. So, Znodes maintains these changes. The stat structure also has timestamps.
The version number, together with the timestamp allow ZooKeeper to validate the cache and to coordinate updates. The version number increases, each time a znode’s data changes.
As an example, the client receives the version of the data, whenever a client retrieves data. Though, it must supply the version of the data of the Znode it is changing, when a client performs an update or a delete. Hence, the update will fail, if the version it supplies doesn’t match the actual version of the data.
d. Name Service
A service that maps a name to some information associated with that name, is what we call a name service. In addition, we can also extend a name service to a group membership service. Because by that it is possible to obtain information pertaining to the group where that entity is, whose name is we are searching.
We may need to implement distributed mutexes, to allow for serialized access to a shared resource in our distributed system. Hence, by ZooKeeper, we can implement them easily.
Basically, for synchronizing access to shared resources we need Hand in hand with distributed mutexes. However, ZooKeeper provides for a simple interface to implement, whether implementing a producer-consumer queue or a barrier.
g. Configuration management
In order to store and manage the configuration of our distributed system centrally, we can use ZooKeeper.
Learn ZooKeeper by ZooKeeper books
h. Leader Election
It is possible that the distributed system may have to deal with the problem of nodes going down. Also, we may want to implement an automatic fail-over strategy. For these type of issues, ZooKeeper offers off-the-shelf support by leader election.
i. ZooKeeper Access Control Using ACLs
In order to control access to its Znodes (the data nodes of a ZooKeeper data tree), ZooKeeper uses ACLs.
So, this was all in ZooKeeper Terminologies. Hope you like our explanation.
3. Conclusion: Zookeeper Terminologies
Hence, we have covered some important ZooKeeper terminologies to understand Zookeeper well. Still, if any doubt regarding, terminologies in ZooKeeper, ask in the comment tab.
See also –
ZooKeeper pros and cons