一片不错的博客
这个 zookeeper 会监听 本身的 2181 接口 和 8080 接口 所以在出现问题的时候可以去检查 8080 端口是否已经被占用
单节点的时,Mode会显示为standalone
在多节点的时候 我们可以看到主是leader,从是follower
开启和检测 zkserver 服务
Start ZooKeeper
Go to where you installed ZooKeeper:
$ cd ~/opt/zookeeper
Run without server administration script arguments to see available options:
$ bin/zkServer.sh
JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Usage: bin/zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
Start ZooKeeper:
$ bin/zkServer.sh start
Check ZooKeeper is Running Correctly
Telnet to the ZooKeeper port and issue one of ZooKeeper’s four letter words, you should see similar output:
$ telnet localhost 2181
开启 zookeeper 命令行
~ /home/conan/toolkit/zookeeper345/bin/zkCli.sh -server 192.168.1.201:2181
查看命令
[zk: 192.168.1.201(CONNECTED) 1] help
ZooKeeper -server host:port cmd args
connect host:port
get path [watch]
ls path [watch]
set path data [version]
rmr path
delquota [-n|-b] path
quit
printwatches on|off
create [-s] [-e] path data acl
stat path [watch]
close
ls2 path [watch]
history
listquota path
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path