相关网站
官网 https://zookeeper.apache.org/
官网的中文翻译(不完整) http://zookeeper.majunwei.com/
应用场景
http://nileader.blog.51cto.com/1381108/1040007
http://www.ibm.com/developerworks/cn/opensource/os-cn-zookeeper/
http://jm.taobao.org/2011/10/08/1232/
ZooKeeper的三种模式和部署
ZooKeeper有单机、伪分布式 和 分布式 三种部署模式
http://www.ibm.com/developerworks/cn/opensource/os-cn-zookeeper-code/index.html
http://www.blogjava.net/BucketLi/archive/2010/12/21/341268.html
http://www.ibm.com/developerworks/cn/data/library/bd-zookeeper/
以上都是安装入门讲解不错的文章
C语言编程
http://www.cnblogs.com/haippy/archive/2013/02/21/2919365.html
注意事项:
有两个库
zookeeper_st和zookeeper_mt,我们尽量都用zookeeper_mt,并且使用的时候加上-DTHREADED,zookeeper_st只支持异步api,并且需要自己处理事件和回调,以下是官方的说明
The package includes two shared libraries: zookeeper_st and zookeeper_mt. The former only provides the asynchronous APIs and callbacks for integrating into the application's event loop. The only reason this library exists is to support the platforms were a
pthread
library is not available or is unstable (i.e. FreeBSD 4.x). In all other cases, application developers should link with zookeeper_mt, as it includes support for both Sync and Async API.
In order to be able to use the ZooKeeper API in your application you have to remember to
-
Include ZooKeeper header: #include
-
If you are building a multithreaded client, compile with -DTHREADED compiler flag to enable the multi-threaded version of the library, and then link against against thezookeeper_mt library. If you are building a single-threaded client, do not compile with -DTHREADED, and be sure to link against the zookeeper_st library.
一些常量定义
# file type masks
ZOO_EPHEMERAL = 1
ZOO_SEQUENCE = 2
# session state
ZOO_EXPIRED_SESSION_STATE = -112
ZOO_AUTH_FAILED_STATE = -113
ZOO_CLOSED_STATE = 0
ZOO_CONNECTING_STATE = 1
ZOO_ASSOCIATING_STATE = 2
ZOO_CONNECTED_STATE = 3
# watch types
ZOO_CREATED_EVENT = 1
ZOO_DELETED_EVENT = 2
ZOO_CHANGED_EVENT = 3
ZOO_CHILD_EVENT = 4
ZOO_SESSION_EVENT = -1
ZOO_NOTWATCHING_EVENT = -2
# only used by the C extension
ZOO_LOG_LEVEL_ERROR = 1
ZOO_LOG_LEVEL_WARN = 2
ZOO_LOG_LEVEL_INFO = 3
ZOO_LOG_LEVEL_DEBUG = 4
# exceptions/errors
ZOK = 0
ZSYSTEMERROR = -1
ZRUNTIMEINCONSISTENCY = -2
ZDATAINCONSISTENCY = -3
ZCONNECTIONLOSS = -4
ZMARSHALLINGERROR = -5
ZUNIMPLEMENTED = -6
ZOPERATIONTIMEOUT = -7
ZBADARGUMENTS = -8
ZINVALIDSTATE = -9
# api errors
ZAPIERROR = -100
ZNONODE = -101
ZNOAUTH = -102
ZBADVERSION = -103
ZNOCHILDRENFOREPHEMERALS = -108
ZNODEEXISTS = -110
ZNOTEMPTY = -111
ZSESSIONEXPIRED = -112
ZINVALIDCALLBACK = -113
ZINVALIDACL = -114
ZAUTHFAILED = -115
ZCLOSING = -116
ZNOTHING = -117
ZSESSIONMOVED = -118
运维&问题
zookeeper运维 http://blog.csdn.net/hengyunabc/article/details/19006911
ZooKeeper运维之数据文件和事务日志 http://blog.csdn.net/jiyiqinlovexx/article/details/42687157
ZooKeeper常见问题 http://blog.csdn.net/jiang_bing/article/details/9280725
zookeeper项目使用几点小结 http://www.cnblogs.com/starhu/p/5403117.html
Zookeeper常见问题整理 http://itindex.net/detail/53431-zookeeper-%E9%97%AE%E9%A2%98
https://wiki.apache.org/hadoop/ZooKeeper/ErrorHandling
https://wiki.apache.org/hadoop/ZooKeeper/FAQ#A3
Zookeeper开发常见问题 http://blog.csdn.net/kobejayandy/article/details/41791399
管理工具 node-zk-browser zkdash zkweb
zookeeper c api的介绍和部分坑 http://www.shengofsun.com/zookeeper/
其他接口
Lua接口 https://github.com/forhappy/zklua
其他分布式协调程序
https://poweryang1990.github.io/2016-03-24/configmanage/