ZooKeeper is a distributed and highly available coordination service. ZooKeeper provides features such as distributed configuration, synchronization, naming, and registration.

How it works

A ZooKeeper cluster consists of an odd number of nodes. One of the nodes is elected leader based on an internal election protocol, and the other nodes are followers. When data is written to a ZooKeeper cluster, the leader coordinates write requests. The data write operation is considered successful only if more than half of the nodes vote and return ACK. Therefore, a ZooKeeper cluster is available only if more than half of its nodes are alive. If the leader unexpectedly exits, the ZooKeeper cluster triggers a leader election again, and another node is elected leader. This ensures the high availability of the cluster.

Data structuring

Similar to standard file systems, ZooKeeper uses a tree-like structure to organize files and uses ZooKeeper nodes (znodes) to describe files. Unlike standard file systems, znodes store data without directories and files. All znodes can store data. Zookeeper

ZooKeeper is a coordination service, and znodes are used to store coordination data, such as information about the service status and configurations. You are not allowed to use ZooKeeper as a file system to store a large amount of data.