zookeeper搭建分布式集群启动失败(Error contacting service. It is probably not running.)

文章目录

1.排查

1.启动zookeeper后查看状态/bin/zkServer.sh status发现报错Error contacting service. It is probably not running.

bash 复制代码
[root@zookeeper01 apache-zookeeper-3.8.2-bin]# ./bin/zkServer.sh status
/usr/bin/java
ZooKeeper JMX enabled by default
Using config: /opt/apache-zookeeper-3.8.2-bin/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost. Client SSL: false.
Error contacting service. It is probably not running.

2.查看日志zookeeper-root-server-zookeeper01.out

发现报了一拒绝链接java.net.ConnectException: 拒绝连接 (Connection refused)

bash 复制代码
[root@zookeeper01 logs]# pwd
/opt/apache-zookeeper-3.8.2-bin/logs
[root@zookeeper01 logs]# ls
zookeeper-root-server-zookeeper01.out
[root@zookeeper01 logs]# vim zookeeper-root-server-zookeeper01.out
bash 复制代码
2023-09-05 01:09:12,322 [myid:] - INFO  [QuorumPeer[myid=1](plain=[0:0:0:0:0:0:0:0]:2181)(secure=disabled):o.a.z.s.q.FastLeaderElection@996] - Notification time out: 400 ms
2023-09-05 01:09:12,323 [myid:] - WARN  [QuorumConnectionThread-[myid=1]-2:o.a.z.s.q.QuorumCnxManager@401] - Cannot open channel to 3 at election address zookeeper03/192.168.75.132: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:607)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager.initiateConnection(QuorumCnxManager.java:384)
        at org.apache.zookeeper.server.quorum.QuorumCnxManager$QuorumConnectionReqThread.run(QuorumCnxManager.java:458)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)

2.解决

将配置文件zoo.cfg中节点对应机器的地址改为:0.0.0.0

修改完再此启动即可解决。

注意:每台机器都要改。不能只改一个节点

bash 复制代码
server.1=0.0.0.0:2888:3888
server.2=zookeeper02:2888:3888
server.3=zookeeper03:2888:3888
quorumListenOnAllIPs=true
相关推荐
命运之手38 分钟前
[ Spring ] Install ZooKeeper on Ubuntu24
spring·zookeeper·ubuntu24
詹姆斯爱研究Java43 分钟前
基于微服务的在线校园便民服务站的设计与实现
微服务·云原生·架构
drebander1 小时前
分布式 ID 生成策略:应用场景与 ShardingSphere 实现
分布式·shardingsphere
醒了就刷牙1 小时前
简历_使用优化的Redis自增ID策略生成分布式环境下全局唯一ID,用于用户上传数据的命名以及多种ID的生成
分布式·面试
VX_CXsjNo12 小时前
免费送源码:Java+SpringBoot+MySQL SpringBoot网上宠物领养管理系统 计算机毕业设计原创定制
java·hadoop·spring boot·mysql·zookeeper·flask·pytest
言之。3 小时前
【Hadoop面试题2025】
大数据·hadoop·分布式
小馋喵知识杂货铺3 小时前
Kafka 控制生产者流量
分布式·kafka
猿java4 小时前
如何使用SLF4J的 MDC, 实现全链路追踪?
java·分布式·面试
小哈里5 小时前
【架构设计】现代软件交付中的灵活性与可靠性———云原生与不可变基础设施(微服务/容器化/持续交付,计算/存储/网络)
网络·微服务·云原生·系统架构·云计算
@@@wang6 小时前
RabbitMQ高级特性之发送方确认
分布式·rabbitmq