• Home
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • CI
  • Install
  • Samples
  • Archived
ZooKeeper | Introduction
  1. Introduction
  2. ZooKeeper ensemble
  3. ZooKeeper quorum

  1. Introduction
    ZooKeeper allows distributed applications to share their configurations in a centralized place.
    Distributed applications can use the shared configuration to coordinate with each other and synchronize their status and data.

    ZooKeeper stores configurations in a tree-like structure.
    Each entry (called znode) in the tree contains data that distributed applications share.
    Also, each znode (parent) can have zero or many znodes (children).
    The root znode is “/”.

    Here's an example of a znodes tree structure:
  2. ZooKeeper ensemble
    ZooKeeper allows creating and configuring a set of ZooKeeper instances to form a cluster.
    This cluster is called a ZooKeeper ensemble.

    For example, we can have 5 instances of ZooKeeper ("ZK_1", "ZK_2", "ZK_3", "ZK_4", "ZK_5") that can be parts of the ZooKeeper ensemble.
    There's only one leader at a specific time (for example: "ZK_1").
    The other ZooKeeper instances (for example: "ZK_2", "ZK_3", "ZK_4", "ZK_5") need to communicate with the ZooKeeper instance leader ("ZK_1") to synchronize their status and data.

    Clients (distributed applications) can communicate with any of the ZooKeeper's instances.
    For example, clients "C_21" and "C_22" can communicate directly with the ZooKeeper's instance "ZK_2".

    Here's an example that shows a possible scenario where multiple clients can communicate with different instances of ZooKeeper:
  3. ZooKeeper quorum
    ZooKeeper instances will answer requests from clients if they form a quorum.
    A majority formed from a minimum set of "up and running" ZooKeeper instances is called a quorum.

    If your ZooKeeper ensemble contains 3 ZooKeeper instances, then a quorum will be formed if a minimum of 2 ZooKeeper instances are up and running.

    The recommendation is that your ZooKeeper ensemble contain an odd number of ZooKeeper instances.

    You can use the equation “2f + 1” to calculate how many failures your ZooKeeper ensemble will tolerate in order to continue responding requests from clients. “f” stands for the number of instances that can be down.

    For example, if your ZooKeeper ensemble contains:
    • 3 ZooKeeper instances (2 * 1 + 1), then 1 instance can be down.

    • 5 ZooKeeper instances (2 * 2 + 1), then 2 instances can be down.

    • 7 ZooKeeper instances (2 * 3 + 1), then 3 instances can be down.
© 2025  mtitek