ZooKeeper: A Distributed Coordination Service for Distributed Applications
See https://zookeeper.apache.org/doc/current/zookeeperOver.html
Install
Standalone Mode on CentOS7
1 | wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/stable/zookeeper-3.4.14.tar.gz |
创建文件conf/zoo.cfg
1 | tickTime=2000 |
Start zk
1 | bin/zkServer.sh start |
Replicated ZooKeeper
至少三台,建议奇数台server,每台安装zk
新建文件dataDir/myid,内容是server number, in ASCII
conf/zoo.cfg
1 | tickTime=2000 |
Startup
进入控制台
1 | # bin/zkCli.sh -server 127.0.0.1:2181 |
简单例子
1 | # 进入控制台以后 |
查看kafka的topic
ls /brokers/topics
检查状态
http://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html#sc_zkCommands
$ echo stat | nc 127.0.0.1 2181