环境:
软件版本:zookeeper-3.4.9
默认安装路径 $ZK_HOME = /usr/zookeeper
解决办法,删除
/var/zookeeper/datadir/zk3/version-2
具体解决步骤
首先查看log--zookeeper.out,默认的这个文件在运行zkServer.sh的目录
more zookeeper.out
好逗比的默认日志输出路径
先修改一下输入日志的路径吧
vi $ZK_HOME\bin\zkEnv.sh
参考:http://blog.csdn.net/huanggang028/article/details/17560731
2017-04-02 22:29:12,447 [myid:] - INFO [main:QuorumPeerConfig@124] - Reading configuration from: /usr/zookeeper/bin/../conf/zoo3.cfg
2017-04-02 22:29:12,471 [myid:] - INFO [main:QuorumPeer$QuorumServer@149] - Resolved hostname: master to address: master/192.168.111.11
2017-04-02 22:29:12,471 [myid:] - INFO [main:QuorumPeer$QuorumServer@149] - Resolved hostname: master to address: master/192.168.111.11
2017-04-02 22:29:12,472 [myid:] - INFO [main:QuorumPeer$QuorumServer@149] - Resolved hostname: master to address: master/192.168.111.11
2017-04-02 22:29:12,472 [myid:] - INFO [main:QuorumPeerConfig@352] - Defaulting to majority quorums
2017-04-02 22:29:12,476 [myid:3] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2017-04-02 22:29:12,477 [myid:3] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2017-04-02 22:29:12,477 [myid:3] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2017-04-02 22:29:12,491 [myid:3] - INFO [main:QuorumPeerMain@127] - Starting quorum peer
2017-04-02 22:29:12,508 [myid:3] - INFO [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2183
2017-04-02 22:29:12,518 [myid:3] - INFO [main:QuorumPeer@1019] - tickTime set to 2000
2017-04-02 22:29:12,518 [myid:3] - INFO [main:QuorumPeer@1039] - minSessionTimeout set to -1
2017-04-02 22:29:12,518 [myid:3] - INFO [main:QuorumPeer@1050] - maxSessionTimeout set to -1
2017-04-02 22:29:12,518 [myid:3] - INFO [main:QuorumPeer@1065] - initLimit set to 10
2017-04-02 22:29:12,544 [myid:3] - INFO [main:FileSnap@83] - Reading snapshot /var/zookeeper/datadir/zk3/version-2/snapshot.100000048
2017-04-02 22:29:12,618 [myid:3] - ERROR [main:QuorumPeer@557] - Unable to load database on disk
java.io.IOException: The current epoch, 4, is older than the last zxid, 21474836487
at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:539)
at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:500)
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)
2017-04-02 22:29:12,631 [myid:3] - 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:558)
at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:500)
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: The current epoch, 4, is older than the last zxid, 21474836487
at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:539)
... 4 more
Removing data from /var/zookeeper/version-2 then restart seems to “fix” the problem (it gets a snapshot from one of the other nodes in the quorum). This is Zookeeper 3.3.5+19.5-1~squeeze-cdh3, i.e. from Cloudera’s distribution.
来源: https://issues.apache.org/jira/browse/ZOOKEEPER-1546
原文和我们遇到的问题好想还不太一样,原文是卡住了重启发生的,并且在后续版本解决了这个问题。
查看起不来的配置文件找到datadir
more /usr/zookeeper/conf/zoo3.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/var/zookeeper/datadir/zk3
dataLogDir=/var/zookeeper/datalog
clientPort=2183
server.1=master:2887:3887
server.2=master:2888:3888
server.3=master:2889:3889
移动到datadir 目录
cd /var/zookeeper/datadir/zk3
删除/var/zookeeper/datadir/zk3/version-2目录
mv version-2 ./version-2.bak
重启问题解决