Concepts · Concept
Zookeper
“ZooKeeper is a distributed coordination service — it doesn’t store your application’s business data at all. Instead, it helps distributed systems agree on shared state: things like leader election, distributed locks, configuration management, and service discovery. It stores small amounts of data in a hierarchical structure (like a filesystem — nodes called ‘znodes’), and guarantees strong consistency across that data using a consensus protocol (ZAB, similar in spirit to Paxos/Raft).”
When to reach for it:
- Leader election — e.g., in a cluster of worker nodes, ZooKeeper helps them agree on which one is “the leader” at any moment, and detects/reassigns if that leader dies (ephemeral znodes disappear automatically if a node crashes/disconnects, making failure detection built-in)
- Distributed locks — coordinating access to a shared resource across multiple machines, when a single Redis lock isn’t strong enough a guarantee
- Configuration management — centrally storing config that many services need to read, and get notified of changes to, consistently
- Service discovery — tracking which service instances are currently alive/registered