zookeeper的一些异常总结

时间:2022-01-01 22:02:32

1.Could not find the main class: org.apache.zookeeper.server.quorum.QuorumPeerMain.  Program will exit.

 

安装包损坏,找不到对应文件。重新安装。

 

2.

2013-03-28 11:13:32,205 - INFO  [main:QuorumPeerConfig@90] - Reading configuration from: /root/zookeeper-3.3.5/bin/../conf/zoo.cfg

2013-03-28 11:13:32,209 - INFO  [main:QuorumPeerConfig@310] - Defaulting to majority quorums

2013-03-28 11:13:32,217 - INFO  [main:QuorumPeerMain@119] - Starting quorum peer

2013-03-28 11:13:32,231 - INFO  [main:NIOServerCnxn$Factory@143] - binding to port 0.0.0.0/0.0.0.0:2181

2013-03-28 11:13:32,241 - INFO  [main:QuorumPeer@819] - tickTime set to 2000

2013-03-28 11:13:32,241 - INFO  [main:QuorumPeer@830] - minSessionTimeout set to -1

2013-03-28 11:13:32,242 - INFO  [main:QuorumPeer@841] - maxSessionTimeout set to -1

2013-03-28 11:13:32,242 - INFO  [main:QuorumPeer@856] - initLimit set to 10

2013-03-28 11:13:32,250 - INFO  [main:FileSnap@82] - Reading snapshot /usr/zookeeper/version-2/snapshot.0

2013-03-28 11:13:32,259 - INFO  [Thread-1:QuorumCnxManager$Listener@473] - My election bind port: 3888

2013-03-28 11:13:32,266 - INFO  [QuorumPeer:/0.0.0.0:2181:QuorumPeer@621] - LOOKING

2013-03-28 11:13:32,267 - INFO  [QuorumPeer:/0.0.0.0:2181:FastLeaderElection@663] - New election. My id =  2, Proposed zxid = 2

2013-03-28 11:13:32,270 - WARN  [WorkerSender Thread:QuorumCnxManager@384] - Cannot open channel to 1 at election address /172.16.217.2:3888

java.net.ConnectException: Connection refused

        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)

        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)

        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:100)

        at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:371)

        at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:340)

        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:360)

        at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:333)

        at java.lang.Thread.run(Thread.java:662)

 

 

如果tomcat服务器异常终止,下次启动时就有可能出现 java.net.BindException: Address already in use (端口号被占用)问题,导致启动失败。使用如下命令查看端口号占用情况:

$netstat -pant | grep 8080    -t参数,显示进程号

 

zookeeper的一些异常总结

可以看到,很明显的端口号还在使用中,这是因为tomcat上次的异常终止,导致部分socket没有关闭,也可能是其他原因,根据个人情况而定。如果等待100s,像上图所示的处于 CLOSE_WAIT状态的连接会自动关闭,如果不想等待,执行如下命令,强制终止进程,从上面可以看出,进程号为 7705 

 

也可以使用如下命令查看占用端口号8080的进程号是什么

$fuser -v -n tcp 8080   

 

 

 

3.

检测集群中zookeeper启动状态:

通过在控制台输入命令检查集群zookeeper启动状态。

命令如“echo ruok | nc 192.168.3.131 2181”

控制台输出“imok”

 

 

4.

Jps命令无法使用:

输入:echo $JAVA_HOME,如果输出的java路径不正确,则找不到jps

环境变量未注册,jps的目录位于java目录中