我有 zookeeper.version=3.4.10,并且我看到:
https://issues.apache.org/jira/browse/ZOOKEEPER-2307
但处于未解决状态。问题是由于磁盘空间已满而出现的。现在我删除了一些日志并释放了空间,我想启动 zookeeper,但由于此错误,它无法启动:
[2019-01-22 09:07:32,646] ERROR Unable to load database on disk
(org.apache.zookeeper.server.quorum.QuorumPeer)
java.io.IOException: The accepted epoch, 13 is less than the current epoch,
14
at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:645)
at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:591)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:164)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:111)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)
[2019-01-22 09:07:32,648] ERROR Unexpected exception, exiting abnormally
(org.apache.zookeeper.server.quorum.QuorumPeerMain)
java.lang.RuntimeException: Unable to run quorum server
at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:649)
at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:591)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:164)
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 accepted epoch, 13 is less than the current epoch, 14
at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:645)
... 4 more
我是否必须修补它(我不确定是否有准备好的补丁),或者我是否可以修复 zookeeper 数据(例如,以某种方式让它接受新的时代)并继续使用相同的版本?
答案1
它起作用了,我刚刚做了:
cp currentEpoch acceptedEpoch
在 zookeeper 数据目录中,它启动时没有任何问题。
答案2
我注意到了http://zookeeper-user.578899.n2.nabble.com/acceptedEpoch-and-currentEpoch-values-not-matching-exception-message-td7581567.html,Otis Gospodnetic 说我可以删除这两个文件(currentEpoch 和 acceptedEpoch)并重新启动,这样可能会恢复 zookeeper,但 Flavio Junqueira 说我不应该这么做。我想我还是会尝试一下。
答案3
这确实解决了问题,
cp ~/zookeeper/version-2/currentEpoch ~/zookeeper/version-2/acceptedEpoch
造成此问题的实际原因是 zookeeper 节点之间的时间同步