zk集群中一个节点启动失败:Unable to load database on disk java.io.IOException: Found c� in /var/learn/zk/vers...

zookeeper集群一共三个节点,其中一个节点启动失败。

日志目录

/opt/learn/zookeeper-3.4.6/conf
[root@node02 conf]# ll
总用量 16
-rw-rw-r-- 1 wangxb wangxb  535 2月  20 2014 configuration.xsl
-rw-rw-r-- 1 wangxb wangxb 2161 2月  20 2014 log4j.properties
-rw-rw-r-- 1 wangxb wangxb 1000 10月  4 01:06 zoo.cfg
-rw-r--r-- 1 root   root   2956 11月  3 12:39 zookeeper.out

异常日志

[root@node02 conf]# tail -500f zookeeper.out 
2019-11-03 12:39:56,225 [myid:] - INFO  [main:QuorumPeerConfig@103] - Reading configuration from: /opt/learn/zookeeper-3.4.6/bin/../conf/zoo.cfg
2019-11-03 12:39:56,229 [myid:] - INFO  [main:QuorumPeerConfig@340] - Defaulting to majority quorums
2019-11-03 12:39:56,232 [myid:1] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2019-11-03 12:39:56,241 [myid:1] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2019-11-03 12:39:56,242 [myid:1] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2019-11-03 12:39:56,259 [myid:1] - INFO  [main:QuorumPeerMain@127] - Starting quorum peer
2019-11-03 12:39:56,274 [myid:1] - INFO  [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181
2019-11-03 12:39:56,300 [myid:1] - INFO  [main:QuorumPeer@959] - tickTime set to 2000
2019-11-03 12:39:56,300 [myid:1] - INFO  [main:QuorumPeer@979] - minSessionTimeout set to -1
2019-11-03 12:39:56,301 [myid:1] - INFO  [main:QuorumPeer@990] - maxSessionTimeout set to -1
2019-11-03 12:39:56,301 [myid:1] - INFO  [main:QuorumPeer@1005] - initLimit set to 10
2019-11-03 12:39:56,324 [myid:1] - INFO  [main:Util@190] - Invalid snapshot /var/learn/zk/version-2/snapshot.1a00000007 len = -397350202 byte = 67
2019-11-03 12:39:56,327 [myid:1] - INFO  [main:FileSnap@83] - Reading snapshot /var/learn/zk/version-2/snapshot.1900000036
2019-11-03 12:39:56,363 [myid:1] - ERROR [main:QuorumPeer@497] - Unable to load database on disk
java.io.IOException: Found c� in /var/learn/zk/version-2/currentEpoch
    at org.apache.zookeeper.server.quorum.QuorumPeer.readLongFromFile(QuorumPeer.java:1159)
    at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:456)
    at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:440)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:153)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:111)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
2019-11-03 12:39:56,366 [myid:1] - ERROR [main:QuorumPeerMain@89] - Unexpected exception, exiting abnormally
java.lang.RuntimeException: Unable to run quorum server 
    at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:498)
    at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:440)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:153)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:111)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
Caused by: java.io.IOException: Found c� in /var/learn/zk/version-2/currentEpoch
    at org.apache.zookeeper.server.quorum.QuorumPeer.readLongFromFile(QuorumPeer.java:1159)
    at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:456)
    ... 4 more

解决方法

进入该节点dataDir目录删除version-2下面的所有文件,重新启动即可。

参考:
https://issues.apache.org/jira/browse/ZOOKEEPER-1546

你可能感兴趣的:(zk集群中一个节点启动失败:Unable to load database on disk java.io.IOException: Found c� in /var/learn/zk/vers...)