1.echo wchp | nc localhost 2181 ,通过路径列出服务器 watch 的详细信息,且它会输出一个与 session 相关的路径。但是出现下面的错误。
[root@xg61 conf]# echo wchp | nc localhost 2181
wchp is not executed because it is not in the whitelist.
2.cd /usr/local/zookeeper/conf下,用vim打开zoo.cfg,在最后添加:
3.重启Zookeeper的服务器和客户端。
./zkServer.sh restart
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
服务器重启成功,接着开启客户端。
[root@xg61 bin]# ./zkCli.sh