【Zookeeper 启动失败】zkServer.sh status Error contacting service. It is probably not running.

启动后查看状态如下

查看日志

程序所在目录下的 logs/zookeeper.out

【Zookeeper 启动失败】zkServer.sh status Error contacting service. It is probably not running._第1张图片

2020-03-17 16:07:04,542 [myid:1] - INFO  [WorkerReceiver[myid=1]:FastLeaderElection@600] - Notification: 1 (message format version), 1 (n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), 1 (n.sid), 0x0 (n.peerEpoch) LOOKING (my state)
2020-03-17 16:07:04,543 [myid:1] - WARN  [WorkerSender[myid=1]:QuorumCnxManager@588] - Cannot open channel to 2 at election address slave1/192.168.113.111:3888
java.net.ConnectException: 拒绝连接 (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:562)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:538)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:452)
        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:433)

问题解析

我的配置文件如下

# 心跳机制时间
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# 数据目录
dataDir=/opt/software/zookeeper-3.4.10/zkData
# 客户端端口
clientPort=2181
server.1=master:2888:3888
server.2=slave1:2888:3888
server.3=slave2:2888:3888
server.4=sn:2888:3888

有很多其它的文章说将本机IP修改为【0.0.0.0】,我也试了一下,发现有同样的问题。

排查的主要是根据启动日志(zookeeper.out)去排查,发现master节点启动后,我排查了其余几个节点,其余的节点启动也是报错,但是是log4j类没找到的异常。发现是我复制到其它节点的zookeeper程序中少了lib目录,因此复制好了之后,逐一节点启动。

结果是成功的。而且本机IP也不需要修改为【0.0.0.0】。

你可能感兴趣的:(大数据)