zookeeper启动失败的排错

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/newjueqi/article/details/38518917
运行zookeeperd后显示启动成功:


JMX enabled by default
Using config: /data/programfiles/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED


但用zkServer.sh status查看,反馈如下:


JMX enabled by default
Using config: /data/programfiles/zookeeper-3.4.5/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.


很奇怪,我用netstat -lntup查了一下端口,没发现2018端口被启用


查了zookeeper.out日志,发现如下的错误:


2014-04-16 11:59:54,425 [myid:] - ERROR [main:ZooKeeperServerMain@63] - Unexpected exception, exiting abnormally
java.net.BindException: Address already in use
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:344)
    at sun.nio.ch.Net.bind(Net.java:336)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:199)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
    at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:95)
    at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:110)
    at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:86)
    at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:52)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)

从错误信息来看,是端口被使用了,但我用netstat -lntup是没被使用的,再用 lsof -i:2181,发现了2181端口果然被占用了


[root@ programfiles]# lsof -i:2181
COMMAND     PID USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
memcached 15843 root   56u  IPv4 1650939492      0t0  TCP .:11213->.:eforward (ESTABLISHED)
php-cgi   28154  www    7u  IPv4 1650939491      0t0  TCP .:eforward->.:11213 (ESTABLISHED)


接下来就很好办了,启用另外一个端口就ok了


[文章作者]曾健生

[作者邮箱]zengjiansheng1@126.com

[作者QQ]190678908

[博客]  http://blog.csdn.net/newjueqi

http://blog.sina.com.cn/h6k65


没有更多推荐了,返回首页