Curator是Netflix公司开源的一个Zookeeper客户端,与Zookeeper提供的原生客户端相比,Curator的抽象层次更高,简化了Zookeeper客户端编程。
它包含以下几个组件:
Component | description |
---|---|
Recipes | Implementations of some of the common ZooKeeper “recipes”. The implementations are built on top of the Curator Framework. |
Framework | The Curator Framework is a high-level API that greatly simplifies using ZooKeeper. It adds many features that build on ZooKeeper and handles the complexity of managing connections to the ZooKeeper cluster and retrying operations. |
Utilities | Various utilities that are useful when using ZooKeeper. |
Client | A replacement for the bundled ZooKeeper class that takes care of some low-level housekeeping and provides some useful utilities. |
Errors | How Curator deals with errors, connection issues, recoverable exceptions, etc. |
Extensions | The curator-recipes package implements the common recipes that are described in the ZooKeeper documentation. To avoid bloating that package, recipes/applications that have a vertical appeal will be put in separate “extension” packages using the naming convention curator-x-name. |
环境配置
- JDK 1.7
- Zookeeper 3.4.8
- Curator 2.11.1
- Maven 3.3
快速入门
Maven依赖
<properties>
<java.version>1.7</java.version>
<curator.version>2.11.1</curator.version>
</properties>
<dependencies>
<dependency>
<groupId>