explaingit

apache/zookeeper

12,763JavaAudience · ops devopsComplexity · 4/5LicenseSetup · moderate

TLDR

A reliable coordination service for distributed systems that helps clusters of computers agree on shared state, elect leaders, and get instant notifications when something changes.

Mindmap

mindmap
  root((repo))
    What it does
      Coordinate clusters
      Store shared state
      Notify on changes
    Use cases
      Leader election
      Distributed locks
      Config storage
    Tech stack
      Java
      Maven
    Distribution
      Apache releases
      Maven Central
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Store cluster configuration that multiple servers need to read and watch for live updates

USE CASE 2

Implement leader election so a distributed cluster automatically picks a replacement when one server fails

USE CASE 3

Coordinate distributed locks so only one worker processes a job at a time

USE CASE 4

Receive instant notifications when a member of a server cluster becomes unavailable

Tech stack

JavaMavenC

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Java 8 or later, binary releases available on the Apache website so you do not need to build from source.

Apache 2.0, use, modify, and distribute freely for any purpose, including commercial products.

In plain English

Apache ZooKeeper is a coordination service for distributed systems. When you have many computers working together as a cluster, they need a reliable way to agree on shared state: which server is currently the leader, what configuration settings are in effect, which jobs are locked by which worker. Without a dedicated tool for this, each team ends up building their own fragile coordination logic. ZooKeeper provides that as a reusable service. You can think of it as a small, highly reliable database that distributed applications use to store coordination data and get notified when something changes. For example, a cluster of servers might all watch a particular entry in ZooKeeper, and when one server becomes unavailable, the others are notified immediately and can elect a replacement leader. ZooKeeper is a foundational piece of infrastructure used inside many large-scale systems. It is written in Java and has been an Apache project for many years. The GitHub repository contains the full source code, and releases are published both on the Apache website and to Maven Central, which is the standard package repository for Java libraries. The README in this repository is brief and mainly points to the project website and wiki for full documentation. Building from source requires Maven and a recent version of Java 8 or later.

Copy-paste prompts

Prompt 1
I have three Java services that need to elect a leader and fail over automatically. Show me how to use Apache ZooKeeper's ephemeral nodes and watches to implement leader election.
Prompt 2
Walk me through starting a single-node ZooKeeper server locally, connecting with the CLI client, creating a znode, and setting up a watch that prints a message when that znode changes.
Prompt 3
My distributed job queue needs to ensure only one worker claims each job. Write a ZooKeeper-based distributed lock in Java using ephemeral sequential nodes.
Prompt 4
Show me how to store application config in ZooKeeper and have multiple running services reload it automatically whenever the config znode is updated.
Prompt 5
How do I configure a ZooKeeper ensemble of three nodes for high availability, and what quorum settings do I need in zoo.cfg?
Open on GitHub → Explain another repo

← apache on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.