By default the whitelist only contains "srvr" command which zkServer.sh uses.
Try echo "srvr" | nc localhost 2181 or set 4lw.commands.whitelist=* see zookeeper doc 4lw.commands.whitelist
4lw.commands.whitelist : (Java system property: zookeeper.4lw.commands.whitelist) New in 3.5.3: A list of comma separated Four Letter Words commands that user wants to use. A valid Four Letter Words command must be put in this list else ZooKeeper server will not enable the command. By default the whitelist only contains "srvr" command which zkServer.sh uses. The rest of four letter word commands are disabled by default. Here's an example of the configuration that enables stat, ruok, conf, and isro command while disabling the rest of Four Letter Words command:
4lw.commands.whitelist=stat, ruok, conf, isro If you really need enable all four letter word commands by default, you can use the asterisk option so you don't have to include every command one by one in the list. As an example, this will enable all four letter word commands: 4lw.commands.whitelist=* Three of the more interesting commands: "stat" gives some general information about the server and connected clients, while "srvr" and "cons" give extended details on server and connections respectively.
Moving forward, Four Letter Words will be deprecated, please use AdminServer instead.
The new method of AdminServer is setting 4lw.commands.whitelist=* and sending an HTTP request to http://localhost:8080/commands/stat using wget or curl .
3条答案
按热度按时间yqkkidmi1#
在Zookeeper邮件列表中问了同样的问题,得到了这个:
很可能您使用了错误的“nc”命令。
不是开玩笑:P有两个不同的“nc”包,语法也不同。在类似debian的发行版中,它们是netcat-openbsd和netcat-traditional,但是我在CentOS中遇到了同样的问题(我记不起包的名字了,抱歉),直到我意识到我用错了。
--托马斯·努涅斯
我发现我的服务器上的nc是nc.openbsd,安装nc.traditional后,
echo "stat" | nc.traditional 10.18.10.30 2181
会传回预期的结果。
5sxhfpxr2#
我发现向
nc
命令添加带有-q
参数的wait会产生预期的输出。echo "ruok" | nc -q 2 localhost 2181
在Ubuntu系统上为我工作。您可能需要在OpenBSD系统上使用-w
而不是-q
。xxslljrj3#
By default the whitelist only contains "srvr" command which zkServer.sh uses.
Try
echo "srvr" | nc localhost 2181
or
set
4lw.commands.whitelist=*
see zookeeper doc 4lw.commands.whitelist
4lw.commands.whitelist=stat, ruok, conf, isro
If you really need enable all four letter word commands by default, you can use the asterisk option so you don't have to include every command one by one in the list. As an example, this will enable all four letter word commands:
4lw.commands.whitelist=*
Three of the more interesting commands: "stat" gives some general information about the server and connected clients, while "srvr" and "cons" give extended details on server and connections respectively.
Moving forward, Four Letter Words will be deprecated, please use AdminServer instead.
The new method of AdminServer is setting
4lw.commands.whitelist=*
and sending an HTTP request tohttp://localhost:8080/commands/stat
usingwget
orcurl
.