Apache Curator
Apache Curator is a Java/JVM client library for Apache ZooKeeper, governed by the Apache Software Foundation, that provides a high-level API framework, fluent builders, and pre-built distributed coordination recipes including leader election, distributed locks, barriers, caches, counters, and service discovery. It significantly simplifies writing reliable distributed applications.
APIs
Apache Curator
Curator provides a high-level Java API with fluent builders for ZooKeeper operations, along with pre-built recipes for leader election, distributed locks (shared, reentrant, rea...
Features
Wraps the raw ZooKeeper client with connection management, retry policies, and error handling for reliable distributed coordination.
Provides a chainable, readable Java DSL for all ZooKeeper CRUD operations including watchers, transactions, and ACLs.
Pre-built implementations of distributed patterns: leader election, locks, semaphores, barriers, counters, queues, and group membership.
curator-x-discovery provides a ZooKeeper-based service registry and discovery mechanism with instance registration and lookup.
curator-async provides a CompletionStage-based async API with O/R modeling and schema migration for ZooKeeper data.
CuratorCache provides an efficient local replica of ZooKeeper subtrees with near-real-time change notifications.
curator-test includes TestingServer (embedded ZooKeeper) and TestingCluster for writing reliable unit and integration tests.
Configurable retry policies (ExponentialBackoff, BoundedExponentialBackoff, RetryNTimes, etc.) for handling transient failures.
Use Cases
Elect a single leader across a cluster for coordinating distributed workloads, using LeaderLatch or LeaderSelector recipes.
Prevent concurrent access to shared resources across JVMs using InterProcessMutex and related lock recipes.
Register microservices with ZooKeeper and discover them by type using curator-x-discovery.
Store and watch shared configuration data across a cluster with automatic change notifications via NodeCache.
Track which nodes are alive in a distributed cluster using GroupMember and PersistentNode recipes.
Generate globally unique sequential IDs or maintain shared atomic counters across a cluster.
Integrations
Curator is built on top of ZooKeeper and requires a running ZooKeeper ensemble.
Earlier versions of Kafka used ZooKeeper (managed via Curator) for broker coordination and metadata.
HBase uses ZooKeeper for master election and region server coordination, often managed via Curator.
Storm uses Curator for its ZooKeeper-based cluster state management.
Spring Cloud Zookeeper integrates with Apache Curator for service discovery and distributed configuration.
All Curator modules are published to Maven Central under org.apache.curator group ID.