内容发布更新时间 : 2025/1/5 22:10:47星期一 下面是文章的全部内容请认真阅读。
Zookeeper使用总结
2015年5月
李 梁
前言
1. 阅读对象
本手册面向对zookeeper技术感兴趣的读者,是使用当中的总结,希望能帮到你们。
目 录
第1章 ZOOKEEPER概述 ........................................................................................................................... 2
1.1 1.2
zookeeper介绍 .................................................................................................................................. 2 zookeeper特性 .................................................................................................................................. 2
第2章 ZOOKEEPER安装和配置 ............................................................................................................... 3
2.1.1 zookeeper安装......................................................................................................................... 3 2.1.2 zookeeper配置......................................................................................................................... 3
2.1.2.1 2.1.2.2 2.1.2.3
单机模式 ...................................................................................................................... 3 伪集群模式 .................................................................................................................. 3 集群模式 ...................................................................................................................... 4
第3章 ZOOKEEPER C API简介 ................................................................................................................ 6
3.1
Watches .............................................................................................................................................. 6 3.1.1 监视函数原型 .......................................................................................................................... 7 3.2
常用API ............................................................................................................................................ 7 3.2.1.1 3.2.1.2 3.2.1.3 3.2.1.4 3.2.1.5 3.2.1.6 3.2.1.7
zookeeper_init .............................................................................................................. 7 zookeeper_close ........................................................................................................... 8 zoo_create ..................................................................................................................... 8 zoo_wexists .................................................................................................................. 9 zoo_set ........................................................................................................................ 10 zoo_get ....................................................................................................................... 10 zoo_state ..................................................................................................................... 10
第4章 客户端C API编译 ........................................................................................................................... 12
4.1 4.2
Linux平台编译 ............................................................................................................................... 12 Window平台编译 ........................................................................................................................... 12
第5章 ZOOKEEPER客户端命令 ............................................................................................................. 13
5.1 5.2
命令行工具的常用操作 .................................................................................................................. 13 ZooKeeper 常用四字命令 .............................................................................................................. 13
第6章 ZOOKEEPER使用常见问题 ......................................................................................................... 15 第7章 附录 .................................................................................................................................................... 16
7.1 7.2 7.3 7.4 7.5
zookeeper初始化、销毁函数 ......................................................................................................... 16 zookeeper辅助函数......................................................................................................................... 16 zookeeper同步接口......................................................................................................................... 17 zookeeper异步接口......................................................................................................................... 18 zookeeper C API 总览 ..................................................................................................................... 20