下载地址
apache索引目录 Index of /dist
分布式部署
- 选择3台机器,这里选择了3台机器
172.23.7.9
172.23.7.10
172.23.7.12
-
创建一个data目录,存放zk数据 例如
/home/hadoop/apache/zookeeper/data
-
在每台机器的data目录下,创建文件 myid,按机器编号写入1,2,3
第一台机器 myid文件写入 1
第二台机器 myid文件写入 2
第三台机器 myid文件写入 3 -
在解压的zk文件中,复制配置文件,配置相关的集群情况
cd conf
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
配置data目录地址
dataDir=/home/hadoop/apache/zookeeper/data
文件末尾配置集群情况
server.1=172.23.7.9:2888:3888
server.2=172.23.7.10:2888:3888
server.3=172.23.7.12:2888:3888
- 针对每个机器,启动服务
zkServer.sh
测试
查看状态
./zkServer.sh status
创建节点并查看
- 使用客户端
./zkCli.sh
- 创建节点和数据并查看
创建 create /testNode 'testValue'
查看 ls /
获取 get /testNode