zookeeper启动后查看status不正常,错误日志如下:
018-10-28 08:44:20,636 [myid:1] - ERROR [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Learner@234] - Unexpected exception
java.net.NoRouteToHostException: No route to host (Host unreachable)
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)
先确保hosts文件配置正确,或者ssh hostname试一下,成功的话就说明hosts没有问题
再检查防火墙状态,关闭防火墙(生产环境请使用端口过滤)
关闭防火墙后稍等一会便恢复正常:
[hadoop@nna zkdata]$ zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/soft/zookeeper/bin/../conf/zoo.cfg
Mode: follower