安装zookeeper出现java.net.NoRouteToHostException: 没有到主机的路由

我采用的是CentOS7操作系统安装zookeeper,我的配置没有问题,三个节点启动后(./zkServer.sh start),用jps查看进程,QuorumPeerMain进程都正常启动

但是

zkServer.sh status 查看状态时,显示的是Error contacting service. It is probably not running.

查看了配置文件和myid,仍然看不出啥问题,后面想着看日志,可是不知道日志在哪里看。

网上看到一篇zookeeper环境搭建中的几个坑[Error contacting service. It is probably not running]的分析及解决

这篇博文提到可以通过

以start-foreground方式启动,会看到启动日志

故采用此命令执行   ./zkServer.sh start-foreground

然后终端就输出以下提示错误:

2017-06-20 10:54:57,691 [myid:1] - WARN  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@588] - Cannot open channel to 2 at election address centos06/192.168.3.9:3888

java.net.NoRouteToHostException: 没有到主机的路由

百度了下,说可能是linux系统的防火前没有关闭,所以我就把三个节点的防火墙关闭了

以下是centos关闭防火墙的正确方式:

禁用防火墙
[root@centos06 ~]# systemctl stop firewalld.service
[root@centos06 ~]#systemctl disable firewalld.service
[root@centos06 ~]#systemctl status firewalld.service (查看关闭状态)
[yellow@centos06 ~]$ systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

关闭防火墙之后,我的zookeeper就正常了

[yellow@centos05 bin]$ ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/yellow/app/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower
[yellow@centos05 bin]$ 

[yellow@centos06 bin]$ ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/yellow/app/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: leader
[yellow@centos06 bin]$ 

[yellow@centos07 bin]$ ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /home/yellow/app/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值