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启动没问题的情况下,查看状态出现这个报错,说明你在配置方面还是有问题存在的。
具体的问题可能存在在以下四个方面:
- 检查zoo.cfg是否配置错误
- 检查myid是否配置错误
- 检查路由是否互通
- 检查防火墙是否开启
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.
更多推荐
已为社区贡献2条内容
所有评论(0)