zookeeper 集群 Cannot open channel to X at election address Error contacting service. It is probably n

本文主要是介绍zookeeper 集群 Cannot open channel to X at election address Error contacting service. It is probably n,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

高概率:1端口占用   


查看某一端口是否被占用
netstat -tunlp |grep 2181

2 配置不对:如下帖

 

 

 

1.问题现象。 启动每一个都提示  STARTED 但是查看 status时全部节点都报错

[root@ip-172-31-19-246 bin]# sh zkServer.sh  start

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.8/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

 

[root@ip-172-31-29-48 bin]# sh zkServer.sh status

 

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.8/bin/../conf/zoo.cfg

Error contacting service. It is probably not running.

 

2.打印日志 看报错  全部节点都报这个错误

 

tail -1000f zookeeper.out 

 

2016-04-27 01:22:50,087 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer$QuorumServer@149] - Resolved hostname: node2.vvshop.cc to address: node2.vvshop.cc/54.254.152.81

2016-04-27 01:22:50,088 [myid:1] - WARN  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@400] - Cannot open channel to 3 at election address node3.vvshop.cc/52.221.223.222: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:381)

        at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:426)

        at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:843)

        at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:822)

2016-04-27 01:22:50,319 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer$QuorumServer@149] - Resolved hostname: node3.vvshop.cc to address: node3.vvshop.cc/52.221.223.222

2016-04-27 01:22:50,319 [myid:1] - INFO  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] - Notification time out: 60000

 

 3.网上寻求解决方案

1.http://freeman983.iteye.com/blog/2053037   log目录没有创建导致出错 并不是原因。

 

2.http://blog.csdn.net/qianggezhishen/article/details/49363349  (我的配置都是对的 但是仍然报错)

ZooKeeper安装使用时遇到各种奇怪问题的解决方法:

1.nohup:failed to run command ‘Java’: No such file or directory
2.Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect

a.检查myid文件数字是否跟配置的能对的上

b.检查myid文件是否已经拷贝到dataDIr配置的路径里了

c.检查/etc/profile和/etc/environment 是否设置了Java和Zookeeper的路径

d.Zookeeper集群节点必须是3个以上

 

3.还是 歪果仁给力 stackoverflow 查到解决方案:

 http://stackoverflow.com/questions/30940981/zookeeper-error-cannot-open-channel-to-x-at-election-address

 例如:

<span style="color:#000000"><span style="color:#393318"><code><span style="color:#303336">server</span><span style="color:#0c0d0e">.</span><span style="color:#b00633">1</span><span style="color:#0c0d0e">=</span><span style="color:#b00633">0.0</span><span style="color:#0c0d0e">.</span><span style="color:#b00633">0.0</span><span style="color:#0c0d0e">:</span><span style="color:#b00633">2888</span><span style="color:#0c0d0e">:</span><span style="color:#b00633">3888</span><span style="color:#303336">
server</span><span style="color:#0c0d0e">.</span><span style="color:#b00633">2</span><span style="color:#0c0d0e">=</span><span style="color:#b00633">192.168</span><span style="color:#0c0d0e">.</span><span style="color:#b00633">10.10</span><span style="color:#0c0d0e">:</span><span style="color:#b00633">2888</span><span style="color:#0c0d0e">:</span><span style="color:#b00633">3888</span><span style="color:#303336">
server</span><span style="color:#0c0d0e">.</span><span style="color:#b00633">3</span><span style="color:#0c0d0e">=</span><span style="color:#b00633">192.168</span><span style="color:#0c0d0e">.</span><span style="color:#b00633">2.1</span><span style="color:#0c0d0e">:</span><span style="color:#b00633">2888</span><span style="color:#0c0d0e">:</span><span style="color:#b00633">3888</span></code></span></span>

 

Step 1:

 

Node 1:

zoo.cfg

server.1= 0.0.0.0:<port>:<port2>

server.2= <IP>:<port>:<port2>

.

.

.

server.n= <IP>:<port>:<port2>

 

Node 2 :

server.1= <IP>:<port>:<port2>

server.2= 0.0.0.0:<port>:<port2>

.

.

.

server.n= <IP>:<port>:<port2>

 

 

 如愿看到: 

 

[root@ip-172-31-29-48 bin]# sh zkServer.sh  status

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.8/bin/../conf/zoo.cfg

Mode: leader

 

[root@ip-172-31-23-7 bin]# sh zkServer.sh  status

 

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.8/bin/../conf/zoo.cfg

Mode: follower

 

[root@ip-172-31-19-246 bin]# sh zkServer.sh  status

ZooKeeper JMX enabled by default

Using config: /usr/local/zookeeper-3.4.8/bin/../conf/zoo.cfg

Mode: follower

 

如果遇到 java.net.NoRouteToHostException: No route to host

建议关闭防火墙试试

Java.net.NoRouteToHostException:No route to host

上网查询的结论如下:

没有路由连接到本机,无法到达远程主机,

原因:防火墙干扰或中间路由器停机

(用telnet查看该机器是否正常连接,结果如下:

Trying 199.155.122.91...
telnet: connect to address 199.155.122.91: No route to host
telnet: Unable to connect to remote host: No route to host)

解决的办法是:和防火墙规则有关,关闭防火墙就可以了

关闭防火墙之后,结果如下:

Trying 199.155.122.91...
telnet: connect to address 199.155.122.91: Connection refused
telnet: Unable to connect to remote host: Connection refused

 http://blog.csdn.net/chenyi8888/article/details/8552860

这篇关于zookeeper 集群 Cannot open channel to X at election address Error contacting service. It is probably n的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/658410

相关文章

Java使用Curator进行ZooKeeper操作的详细教程

《Java使用Curator进行ZooKeeper操作的详细教程》ApacheCurator是一个基于ZooKeeper的Java客户端库,它极大地简化了使用ZooKeeper的开发工作,在分布式系统... 目录1、简述2、核心功能2.1 CuratorFramework2.2 Recipes3、示例实践3

mysql出现ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost‘ (10061)的解决方法

《mysql出现ERROR2003(HY000):Can‘tconnecttoMySQLserveron‘localhost‘(10061)的解决方法》本文主要介绍了mysql出现... 目录前言:第一步:第二步:第三步:总结:前言:当你想通过命令窗口想打开mysql时候发现提http://www.cpp

Pycharm安装报错:Cannot detect a launch configuration解决办法

《Pycharm安装报错:Cannotdetectalaunchconfiguration解决办法》本文主要介绍了Pycharm安装报错:Cannotdetectalaunchconfigur... 本文主要介绍了Pycharm安装报错:Cannot detect a launch configuratio

MyBatis-Plus中Service接口的lambdaUpdate用法及实例分析

《MyBatis-Plus中Service接口的lambdaUpdate用法及实例分析》本文将详细讲解MyBatis-Plus中的lambdaUpdate用法,并提供丰富的案例来帮助读者更好地理解和应... 目录深入探索MyBATis-Plus中Service接口的lambdaUpdate用法及示例案例背景

Android里面的Service种类以及启动方式

《Android里面的Service种类以及启动方式》Android中的Service分为前台服务和后台服务,前台服务需要亮身份牌并显示通知,后台服务则有启动方式选择,包括startService和b... 目录一句话总结:一、Service 的两种类型:1. 前台服务(必须亮身份牌)2. 后台服务(偷偷干

Ollama整合open-webui的步骤及访问

《Ollama整合open-webui的步骤及访问》:本文主要介绍如何通过源码方式安装OpenWebUI,并详细说明了安装步骤、环境要求以及第一次使用时的账号注册和模型选择过程,需要的朋友可以参考... 目录安装环境要求步骤访问选择PjrIUE模型开始对话总结 安装官方安装地址:https://docs.

使用TomCat,service输出台出现乱码的解决

《使用TomCat,service输出台出现乱码的解决》本文介绍了解决Tomcat服务输出台中文乱码问题的两种方法,第一种方法是修改`logging.properties`文件中的`prefix`和`... 目录使用TomCat,service输出台出现乱码问题1解决方案问题2解决方案总结使用TomCat,

解决systemctl reload nginx重启Nginx服务报错:Job for nginx.service invalid问题

《解决systemctlreloadnginx重启Nginx服务报错:Jobfornginx.serviceinvalid问题》文章描述了通过`systemctlstatusnginx.se... 目录systemctl reload nginx重启Nginx服务报错:Job for nginx.javas

centos7基于keepalived+nginx部署k8s1.26.0高可用集群

《centos7基于keepalived+nginx部署k8s1.26.0高可用集群》Kubernetes是一个开源的容器编排平台,用于自动化地部署、扩展和管理容器化应用程序,在生产环境中,为了确保集... 目录一、初始化(所有节点都执行)二、安装containerd(所有节点都执行)三、安装docker-

如何在一台服务器上使用docker运行kafka集群

《如何在一台服务器上使用docker运行kafka集群》文章详细介绍了如何在一台服务器上使用Docker运行Kafka集群,包括拉取镜像、创建网络、启动Kafka容器、检查运行状态、编写启动和关闭脚本... 目录1.拉取镜像2.创建集群之间通信的网络3.将zookeeper加入到网络中4.启动kafka集群