zk系列-c++下zookeeper使用实例
ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务。分布式应用可以使用它来实现诸如:统一命名服务、配置管理、分布式锁服务、集群管理等功能。公司常用到的是Java服务集群的管理。 1.函数介绍 [cpp] view plain copy //create a handle to used communicate with zookeeper zhandle_t *zookeeper_init( const char *host, watcher_fn fn, int recv_timeout, const clientid_t *clientid, void *context, int flags) //create a node synchronously int zoo_create(zhandle_t *zh, const char *path, const char *value, int valuelen, const struct ACL_vector *acl, int flags, char *path_buffer, int path_buffer_len); //lists the children of a node synchronously. int zoo_wget_children(zhandle_t *zh, const char