当我运行命令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
1条答案
按热度按时间czq61nw11#
请确保您的Zookeeper示例已启动并正在运行**,然后再尝试连接**它。
要检查Zookeeper的状态,请执行:
输出应类似于:
如果不起作用,请检查:
JAVA_HOME
环境变量。您也可以运行export JAVA_HOME=$(/usr/libexec/java_home)
(在macOS上)来确保它是正确的。lsof -i :2181
、lsof -i :8080
(通过分别更改clientPort
和admin.serverPort
,可以在zoo.cfg
中配置两个端口)