在安装zookeeper 伪集群的时候,开启第三个节点,显示已经开启。
[root@localhost zookeeper3]# /usr/local/zookeeper346-3/bin/zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper346-3/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
但是ps -ef | grep zookeeper 的时候却只显示2个节点。没有第三个节点。
同时查看第三个节点的状态显示:
[root@localhost zookeeper3]# /usr/local/zookeeper346-3/bin/zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper346-3/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
当时找了一会没找到,对比了conf/zoo.cfg文件里面的配置,感觉没有什么不对劲的。于是看第三个节点的日志
显示:
[root@localhost zookeeper3]# ll
total 20
drwxr-xr-x. 3 root root 4096 Oct 15 11:54 logs
-rwxr-xr-x. 1 root root 2 Oct 15 12:20 myid
drwxr-xr-x. 2 root root 4096 Oct 15 11:54 version-2
-rw-r--r--. 1 root root 1622 Oct 15 13:26 zookeeper.out
-rw-r--r--. 1 root root 5 Oct 15 13:26 zookeeper_server.pid
[root@localhost zookeeper3]# cat zookeeper.out
2014-10-15 12:26:14,035 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading configuration from: /usr/local/zookeeper346-3/bin/../conf/zoo.cfg
2014-10-15 12:26:14,044 [myid:] - INFO [main:QuorumPeerConfig@340] - Defaulting to majority quorums
2014-10-15 12:26:14,051 [myid:3] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2014-10-15 12:26:14,054 [myid:3] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2014-10-15 12:26:14,055 [myid:3] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2014-10-15 12:26:14,131 [myid:3] - INFO [main:QuorumPeerMain@127] - Starting quorum peer
2014-10-15 12:26:14,168 [myid:3] - INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2182
2014-10-15 12:26:14,169 [myid:3] - ERROR [main:QuorumPeerMain@89] - 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:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
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.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:130)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:111)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
[root@localhost zookeeper3]#