环境:

        3台centos Linux 6.6_x64

现象:

       安装完zookeeper以后,各台机器执行./zkServer.sh start启动正常,再执行./zkServer.sh status提示:Error contacting service. It is probably not running.

       如下:

[hadoop@node0 zookeeper-3.4.6]$ ./bin/zkServer.sh start
JMX enabled by default
Using config: /home/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@node0 zookeeper-3.4.6]$ ./bin/zkServer.sh status
JMX enabled by default
Using config: /home/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

原因:

在修改主机名时将/etc/hosts中127.0.0.1对应的localhost.localdomain改成了node0,导致启动后绑定端口出错。

127.0.0.1   localhost node0 localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6


192.168.100.12 node0
192.168.100.13 node1
192.168.100.14 node2

解决:将/etc/hosts仍改回如下,即可。

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6


192.168.100.12 node0
192.168.100.13 node1
192.168.100.14 node2

问题解决,再次运行结果如下:


[root@node0 zookeeper-3.4.6]# ./bin/zkServer.sh start
JMX enabled by default
Using config: /home/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@node0 zookeeper-3.4.6]# ./bin/zkServer.sh status
JMX enabled by default
Using config: /home/hadoop/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐