ZooKeeper -命令zkCli未连接

wljmcqd8  于 2022-12-09  发布在  Apache
关注(0)|答案(1)|浏览(282)

当我运行命令zkCli时,我得到了以下输出:

Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is enabled
[zk: localhost:2181(CONNECTING) 0] ls /
KeeperErrorCode = ConnectionLoss for /
[zk: localhost:2181(CONNECTING) 1]

我使用自制安装和服务启动zookeeper,它成功启动!zkServer status如下所示
第一次
印字机

Zookeeper version: 3.5.6-SNAPSHOT--1, built on 02/27/2020 03:01 GMT
Latency min/avg/max: 0/0/0
Received: 1
Sent: 0
Connections: 1
Outstanding: 0
Zxid: 0xe02
Mode: standalone
Node count: 83

zoo.cfg此文件需要添加什么?
homebrew安装路径是/usr/local/Cellar/zookeeper/3.5.7/bin echo打印Zookeeper version: 3.5.6-SNAPSHOT--1版本有问题吗?
现在我跟踪zookeeper.log并找出异常

2020-06-08 18:36:36 ClientCnxn [WARN] Session 0x0 for server localhost/0:0:0:0:0:0:0:1:2181, unexpected error, closing socket connection and attempting reconnect
java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
    at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:296)
    at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1104)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1139)
2020-06-08 18:36:36 NIOServerCnxn [WARN] Unable to read additional data from client sessionid 0x0, likely client has closed socket
czq61nw1

czq61nw11#

请确保您的Zookeeper示例已启动并正在运行**,然后再尝试连接**它。
要检查Zookeeper的状态,请执行:

zkServer status

输出应类似于:

Client port found: 2181. Client address: localhost.
Mode: standalone

如果不起作用,请检查:

  • 如果Zookeeper日志文件中有任何内容
  • 您的JAVA_HOME环境变量。您也可以运行export JAVA_HOME=$(/usr/libexec/java_home)(在macOS上)来确保它是正确的。
  • 未使用的端口:lsof -i :2181lsof -i :8080(通过分别更改clientPortadmin.serverPort,可以在zoo.cfg中配置两个端口)

相关问题