ZooKeeper JMX enabled by default Using config......完美解决

文章适合了解Zookeeper启动查看状态报错的原因。文章在编写过程中难免有疏漏和错误,欢迎大佬指出文章的不足之处;更多内容请点进👉 Lino_White 👈查看。
未来的世界充满着各式各样的数据,我们该怎么好好利用起来呢?开启正文吧~~~

ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper/bin/…/conf/zoo.cfg
Error contacting service. It is probably not running.

[root@hadoop102 zookeeper]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

如果在Zookeeper启动没问题的情况下,查看状态出现这个报错,说明你在配置方面还是有问题存在的。
具体的问题可能存在在以下四个方面:

  1. 检查zoo.cfg是否配置错误
  2. 检查myid是否配置错误
  3. 检查路由是否互通
  4. 检查防火墙是否开启

zoo.cfg文件

....
dataDir=/usr/local/zookeeper/data
....
server.1=hadoop102:2888:3888
server.2=hadoop103:2888:3888
server.3=hadoop104:2888:3888

hadoop102的myid文件

1

hadoop103的myid文件

2

hadoop104的myid文件

3

三台机子相互使用以下命令

ping hadoop102
ping hadoop103
ping hadoop104

如果以上都配置没问题,那么就到重点了!

...
2021-01-09 12:31:55,831 [myid:2] - WARN  [QuorumPeer[myid=2]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@588] - Cannot open channel to 3 at election address hadoop103/192.168.1.103:3888
java.net.NoRouteToHostException: 没有到主机的路由 (Host unreachable)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
......
......

那就是你防火墙没关了,不急!
有些人可能执行完命令,查看防火墙状态都看到关了,但还是报错,这个时候就让我们了解了解吧。

出现这个问题说明防火墙还没关闭,centos7.0默认不是使用iptables方式管理防火墙,而是firewalld方式,centos6.0防火墙才使用iptables管理。

如果是centos7.0版本的用户,需要关闭firewall防火墙,具体方法如下:

03 zookeeper]# systemctl stop firewalld  #停止firewall防火墙

03 zookeeper]# systemctl disable firewalld  #禁止firewall开机启动

03 zookeeper]# systemctl status firewalld  #查看firewall状态
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
   Active: inactive (dead)

1月 09 12:19:49 hadoop103 systemd[1]: Starting firewalld - dynamic firewal.....
1月 09 12:19:51 hadoop103 systemd[1]: Started firewalld - dynamic firewall...n.
1月 09 12:37:29 hadoop103 systemd[1]: Stopping firewalld - dynamic firewal.....
1月 09 12:37:30 hadoop103 systemd[1]: Stopped firewalld - dynamic firewall...n.
Hint: Some lines were ellipsized, use -l to show in full.

如果是centos6.0版本的用户,需要关闭iptables防火墙,具体方法同关闭firewall防火墙一样,把firewalld替换成iptables而已。

03 zookeeper]# systemctl stop iptables  #停止firewall防火墙

03 zookeeper]# systemctl disable iptables  #禁止firewall开机启动

03 zookeeper]# systemctl status iptables  #查看firewall状态
iptables.service - iptables - dynamic iptables daemon
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
   Active: inactive (dead)

1月 09 12:19:49 hadoop103 systemd[1]: Starting iptables - dynamic iptables.....
1月 09 12:19:51 hadoop103 systemd[1]: Started iptables - dynamic iptables...n.
1月 09 12:37:29 hadoop103 systemd[1]: Stopping iptables - dynamic iptables.....
1月 09 12:37:30 hadoop103 systemd[1]: Stopped iptables - dynamic iptables...n.
Hint: Some lines were ellipsized, use -l to show in full.
  • 22
    点赞
  • 57
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值