启动安全的 zookeeper CLI 连接到 ZK 服务器时找不到命令

Command not found while starting the secured zookeeper CLI to connect to ZK server

我已将 ZK 服务器配置为使用 SSL(签名证书、信任库、密钥库、已修改 zookeeper.properties 所有设置均已完成且良好)。 Zookeeper 启动并在端口 2182 上侦听 SSL 请求并且 zookeeper 和 kafka 服务器日志中没有错误。

#new properties added in kafka/config/zookeeper.properties
secureClientPort=2182
authProvider.x509=org.apache.zookeeper.server.auth.X509AuthenticationProvider
serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory
ssl.trustStore.location=/path/to/ssl/kafka.zookeeper.truststore.jks
ssl.trustStore.password=serversecret
ssl.keyStore.location=/path/to/ssl/kafka.zookeeper.keystore.jks
ssl.keyStore.password=serversecret
ssl.clientAuth=need

现在要使用 ZK-CLI 连接到安全的 zookeeper,我将遵循类似的方法。创建 zk-client 证书,对其进行签名,为其创建信任库和密钥库。创建属性文件并尝试连接到 ZK 服务器,但出现错误

Command not found: Command not found /path/to/ssl/zookeeper-client.properties


$ kafka/bin/zookeeper-shell.sh localhost:2182 -zk-tls-config-file /Users/path/to/ssl/zookeeper-client.properties

Connecting to localhost:2182

ZooKeeper -server host:port cmd args
    addauth scheme auth
    close
.....
Command not found: Command not found /Users/path/to/ssl/zookeeper-client.properties

我的动物园管理员-client.properties看起来像这样

 $cat /Users/path/to/ssl/zookeeper-client.properties
#zookeeper.connect=localhost:2182
zookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNetty
zookeeper.ssl.client.enable=true
zookeeper.ssl.protocol=TLSv1.2
zookeeper.ssl.truststore.location=/Users/path/to/ssl/kafka.zookeeper-client.truststore.jks
zookeeper.ssl.truststore.password=serversecret
zookeeper.ssl.keystore.location=/Users/path/to/ssl/kafka.zookeeper-client.keystore.jks
zookeeper.ssl.keystore.password=serversecret

Kafka 服务器在 ZK 开始处记录。

[2021-07-16 11:27:38,676] INFO binding to port 0.0.0.0/0.0.0.0:2181 (org.apache.zookeeper.server.NettyServerCnxnFactory)
[2021-07-16 11:27:43,760] INFO bound to port 2181 (org.apache.zookeeper.server.NettyServerCnxnFactory)
.....

[2021-07-16 11:27:43,819] INFO Using org.apache.zookeeper.server.NettyServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory)
[2021-07-16 11:27:43,819] INFO binding to port 0.0.0.0/0.0.0.0:2182 (org.apache.zookeeper.server.NettyServerCnxnFactory)
[2021-07-16 11:27:43,821] INFO bound to port 2182 (org.apache.zookeeper.server.NettyServerCnxnFactory)

...

当我尝试使用 zk-client 连接到端口 2182 时,服务器日志没有显示条目(可能是因为它无法连接,因为启动连接的命令失败)

我正在使用 kafka_2.12 版本并且它有 zookeeper-3.5.7

我在这里错过了什么?对我来说,配置看起来符合预期,zk-cli 不应该抛出

参考:

谢谢, 乙

我认为问题在于您的 cli 运行 来自尚不支持此参数的旧版本,请检查您的执行路径,您是否真的从“当前”版本执行?