-
Notifications
You must be signed in to change notification settings - Fork 434
Getting Started
Curator users are assumed to know ZooKeeper. A good place to start is here: http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html
The Curator JARs are available from Maven Central. The various artifacts are listed here: https://github.com/Netflix/curator/wiki. Users of Maven, Gradle, Ant, etc. can easily include Curator into their build script.
Most users will want to use one of Curator’s pre-built recipes. So, the curator-recipes
is the correct artifact to use. If you only want a wrapper around ZooKeeper that adds connection management and retry policies, use curator-framework
.
Curator uses Fluent Style. If you haven’t used this before, it might seem odd so it’s suggested that you familiarize yourself with the style.
Curator connection instances are allocated from the CuratorFrameworkFactory
. You only need one Curator object for each ZooKeeper cluster you are connecting to:
CuratorFrameworkFactory.newClient(zookeeperConnectionString, retryPolicy)
This will create a connection to a ZooKeeper cluster using default values. The only thing that you need to specify is the retry policy. For most cases, you should use:
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3)
CuratorFramework client = CuratorFrameworkFactory.newClient(zookeeperConnectionString, retryPolicy);
client.start();
The client must be started (and closed when no longer needed).
Once you have a CuratorFramework instance, you can make direct calls to ZooKeeper in a similar way to using the raw ZooKeeper
object provided in the ZooKeeper distribution. E.g.:
client.create().forPath("/my/path", myData)
The benefit here is that Curator manages the ZooKeeper connection and will retry operations if there are connection problems.
ssss
- Curator
- Javadoc
- Coverage Report
- Getting Started
- Examples
- FAQ
- Client
- Framework
-
Recipes
- Leader Latch
- Leader Election
- Shared Reentrant Lock
- Shared Lock
- Shared Reentrant Read Write Lock
- Shared Semaphore
- Multi Shared Lock
- Distributed Queue
- Distributed Id Queue
- Distributed Priority Queue
- Distributed Delay Queue
- Simple Distributed Queue
- Barrier
- Double Barrier
- Shared counter
- Distributed Atomic Long
- Path Cache
- Node Cache
- Utilities – Test Server, Test Cluster, ZKPaths, EnsurePath, QueueSharder, Reaper, ChildReaper
- Tech Notes
- Errors
- Exhibitor Integration
- Extensions
- Logging and Tracing