Apache ZooKeeper
The coordination service from Yahoo that a generation of Hadoop-era systems use for leader election, membership and configuration.
- What it is
- Coordination services
- Type
- Open source
- Made by
- Apache Software Foundation
- License
- Apache 2.0
- Facts checked
- 6 October 2026
What it is
ZooKeeper is a Java server that runs as an ensemble of usually three or five machines. Its data is a tree of small nodes called znodes, named like file paths (/app/config), each holding a little data: kilobytes, with a cap just under 1 MB. The whole tree is kept in memory, backed by a transaction log and snapshots on disk. A client connects to any one server. Reads are answered from that server’s copy, which makes them fast but possibly a little behind, so a client that needs the latest value calls sync first. Writes are forwarded to the leader, which orders them and broadcasts them to the followers with its own protocol, Zab; a write commits once a majority has it. ZooKeeper does best when reads outnumber writes about ten to one.
There is deliberately no lock API. Instead ZooKeeper offers building blocks. Ephemeral znodes are deleted when the session that created them ends, so a crashed client’s entries vanish. Sequential znodes get a rising counter appended to their name. Watches send a client one notification when a znode or its children change, and since version 3.6 a persistent, recursive watch can follow a whole subtree. From these, clients build locks, leader elections, barriers and queues: for a lock, each client creates an ephemeral sequential child, the lowest number holds the lock, and every other client watches only the one just ahead of it. Apache Curator packages these recipes for Java.
HBase requires it, HDFS uses it for automatic NameNode failover, and Solr, Druid, NiFi and Fluss rely on it for coordination, such as electing leaders. Kafka was its best-known user until Kafka 4.0 (March 2025) replaced it with its own Raft quorum. The current release is 3.9.6 and the stable line is 3.8.
Why teams pick it
- Proven for well over a decade underneath HBase, HDFS, Solr, Druid and, for most of its life, Kafka
- Any server answers reads from memory, so read-heavy coordination stays fast
- Ephemeral and sequential znodes make locks, elections and membership lists simple, ordered and free of thundering herds
- Apache Curator provides tested recipes such as leader latches, locks and service discovery
Watch out for
- Reads can be stale unless you call
sync; only writes are linearizable - A standard watch fires once and must be set again, so a client can miss changes that happen in between
- A JVM service with its own wire protocol (Jute): heap and disk tuning to do, and first-class clients mainly for Java and C
- Losing ground as systems build Raft in: Kafka removed it in 4.0, Druid 38 moved segment discovery off it, and Fluss plans to drop it
Alternatives
What all coordination services have in common →How it fits with other technologies
What Apache ZooKeeper uses
- Apache ZooKeeperis a required dependency ofApache HBase
- Apache ZooKeeperdrives automatic NameNode failover inApache Hadoop
- Apache ZooKeeperheld cluster metadata, until 4.0, forApache Kafka
- Apache ZooKeeperelects Coordinator and Overlord leaders forApache Druid
- Apache ZooKeepercan elect the cluster coordinator forApache NiFi
- Apache ZooKeeperelects the active CoordinatorServer forApache Fluss
- Apache ZooKeepercan hold the leader key forPatroni
- Apache ZooKeepercan hold the topology and locks ofVitess
What uses Apache ZooKeeper
Persistent, ephemeral and sequential znodes, and a watch, in the CLI · bash
bin/zkCli.sh -server zk1:2181,zk2:2181,zk3:2181
create /workers
# ephemeral: deleted automatically when this session ends
create -e /workers/worker-7 10.0.3.7
# sequential: ZooKeeper appends a rising counter, the basis of fair locks
create /locks
create -s -e /locks/job- worker-7 # Created /locks/job-0000000003
# be notified once when the list of workers changes
ls -w /workersSee it in a real stack
No architecture uses Apache ZooKeeper yet. Drop it into the playground and wire it up yourself.Open playground →Where it came from2008–2025
In the late 2000s Yahoo ran many distributed systems that each needed the same things: a leader, a list of live servers, shared configuration. Its web crawler’s Fetching Service and the Yahoo! Message Broker, a publish-subscribe system with thousands of topics, are two examples. Google had answered the same need with Chubby, a lock service. Patrick Hunt, Mahadev Konar, Flavio Junqueira and Benjamin Reed took a different route: a “coordination kernel” of simple, wait-free data objects with watches and strict ordering, from which applications build whatever primitives they need.
ZooKeeper moved to the Apache Software Foundation in 2008 as part of the Hadoop project, and its authors described it at USENIX ATC in 2010, the year it became a top-level Apache project. It became the default coordination layer for the Hadoop ecosystem and beyond: HBase, HDFS failover, Kafka, Solr and Druid. Apache Curator, which packages the common recipes, graduated to a top-level project in 2013.
Newer coordination stores built on Raft, etcd and Consul, offered alternatives, and some systems began to build consensus in. In 2019 Kafka’s KIP-500 proposed replacing ZooKeeper with a metadata quorum inside Kafka, and Kafka 4.0 shipped without ZooKeeper in March 2025, with thanks to the ZooKeeper community. ZooKeeper itself remains maintained, with 3.9 as its current line.
Why it’s built this way
- No locks on the server, only wait-free objects
- Blocking primitives let slow or faulty clients hurt fast ones, and make the server depend on other clients’ responses and failures. Exposing simple objects let each application build exactly the primitive it needed.
- Reads served locally, writes ordered by one leader
- Coordination workloads are mostly reads; Yahoo’s crawler saw between 10 and 100 reads per write. Answering reads from each server’s memory scales them, while Zab gives every write a single global order.
- Ephemeral and sequential znodes
- Tying a znode to a session turns a client crash into a node disappearing, which is failure detection for free. Sequence numbers give every contender a place in line, so a lock can pass to the next client without waking all of them.
- Watches like cache invalidations
- A client can cache, say, the current leader and be told once when it changes, instead of polling, the same idea distributed file systems use to keep caches fresh.
Timeline
- 2008
Comes to the Apache Software Foundation, under the Hadoop project
- 2010
USENIX ATC paper; becomes a top-level Apache project
- 2013
Apache Curator, the recipe library, graduates to a top-level project
- 2019
Kafka’s KIP-500 proposes replacing ZooKeeper with a built-in quorum
- 2025
Kafka 4.0 ships without ZooKeeper
- Hunt, Konar, Junqueira, Reed: ZooKeeper, wait-free coordination for Internet-scale systems (USENIX ATC 2010)
- The ZooKeeper paper, full text (PDF)
- ASF Milestones: ZooKeeper arrives in 2008, top-level in 2010; Curator graduates in 2013
- Apache Hadoop news: ZooKeeper graduates from a Hadoop subproject
- Apache Incubator: Curator project status (graduated September 2013)
- KIP-500: Replace ZooKeeper with a self-managed metadata quorum
- Apache JIRA KAFKA-9119: KIP-500 (opened October 2019)
- Apache Kafka 4.0.0 release announcement (Mar 2025)
- Apache ZooKeeper releases (3.9 current, 3.8 stable)
Sources21 · facts checked 6 October 2026
- ZooKeeper docs: Overview (in-memory tree, local reads, leader and followers, 10:1 reads)
- ZooKeeper docs: Programmer’s guide (znode types, data under 1 MB, watches, persistent recursive watches, sync)
- ZooKeeper docs: Administrator’s guide (ensembles, odd sizes, jute.maxbuffer)
- ZooKeeper docs: Internals (atomic broadcast, consistency guarantees)
- ZooKeeper docs: Recipes (locks without herd effect, leader election)
- ZooKeeper docs: CLI (create -e, create -s, ls -w)
- Hunt et al.: ZooKeeper paper (USENIX ATC 2010, PDF): Zab, wait-free design, Yahoo applications
- Apache ZooKeeper releases (3.9.6 current, 3.8.7 stable)
- Apache Curator: client library and recipes for ZooKeeper
- etcd docs: Why etcd (ZooKeeper’s Jute protocol and language bindings, from etcd’s perspective)
- Apache HBase reference guide: ZooKeeper (a distributed HBase depends on it)
- Apache Hadoop docs: HDFS high availability with QJM (ZooKeeper and ZKFC for automatic failover)
- Apache Solr reference guide: ZooKeeper ensemble configuration
- Apache Druid docs: ZooKeeper (Coordinator and Overlord leader election, service discovery)
- Apache Druid 38.0.0 release notes (ZooKeeper changes)
- NiFi docs: Administration guide (ZooKeeper and Kubernetes clustering)
- Fluss docs: Architecture (CoordinatorServer elected through ZooKeeper)
- Fluss roadmap (ZooKeeper removal)
- Apache Kafka 4.0.0 release announcement (Mar 2025)
- Patroni on GitHub: a template for PostgreSQL HA with ZooKeeper, etcd or Consul
- Vitess docs: Topology service (etcd, ZooKeeper or Consul)