zookeeper强制关机无法启动Unable to load database on disk具体解决步骤

环境: 软件版本:zookeeper-3.4.9 默认安装路径 $ZK_HOME = /usr/zookeeper

解决办法,删除 /var/zookeeper/datadir/zk3/version-2

具体解决步骤

首先查看log--zookeeper.out,默认的这个文件在运行zkServer.sh的目录

more zookeeper.out

好逗比的默认日志输出路径

zk默认的日志输出路径.png

先修改一下输入日志的路径吧

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

重启问题解决

特别感谢:http://blog.csdn.net/ashic/article/details/47088299

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏Hongten

Hibernate中使用memcached

Hibernate-memcached是CacheProvider接口的memcached实现

20420
来自专栏用户画像

第21章 DHCP

1.在TCP/IP协议族中,应用层的各种服务是建立在传输层提供服务的基础上,下列哪组协议需要使用传输层的TCP建立连接()。

10720
来自专栏IT笔记

SpringBoot2.x开发案例之整合Quartz任务管理系统

基于spring-boot 2.x + quartz 的CRUD任务管理系统,适用于中小项目。 基于spring-boot +quartz 的CRUD任务管理系...

1.1K70
来自专栏潇涧技术专栏

Gradle Plugin for Android Development User Guide 1

Gradle Plugin for Android Development User Guide (1)

9830
来自专栏Spring相关

springBoot上传文件时MultipartFile报空问题解决方法

之前用spring MVC,转成spring boot之后发现上传不能用。网上参考说是spring boot已经有CommonsMultipartResolve...

37810
来自专栏小樱的经验随笔

php实现文件上传

存档: upload1.html(单文件上传) 1 <html> 2 <head> 3 <title>单个文件上传</title>...

80260
来自专栏Netkiller

Glusterfs 文件系统

Glusterfs 我的系列文档 Netkiller Architect 手札 Netkiller Developer 手札 Netkiller PHP...

378100
来自专栏闵开慧

hive.metastore.HiveMetaStoreClient​

14/04/07 15:33:21 INFO hive.metastore: Waiting 1 seconds before next connection ...

36780
来自专栏乐沙弥的世界

Oracle cloud control 12c 如何修改sysman密码

    前阵子在虚拟机部署了Oracle Cloud Control 12c,事别几日,竟然忘记了登陆密码。主要是因为现在的Oracle有关的Software...

10110
来自专栏云鼎实验室的专栏

Exploiting Jolokia Agent with Java EE Servers

0x00 - About Jolokia Jolokia 是一个通过 HTTP 的 JMX 连接器,提供了类 RESTful 的操作方式,可以通过 POST J...

50660

扫码关注云+社区

领取腾讯云代金券