Zookeeper无法启动,报“Unable to load database on disk”

转载说明:如果您喜欢这篇文章并打算转载它,请私信作者取得授权。感谢您喜爱本文,请文明转载,谢谢。


问题描述:

测试环境部署zookeeper的服务器磁盘满了,引起服务异常,将zookeeper进程杀掉之后,重新启动zookeeper启动的时候显示成功了:

复制代码
[root@slave-2 bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

但是zookeeper的进程和端口都没有起来。

查看zookeeper.out,发现有报错信息如下:

复制代码
2023-05-07 10:33:58,556 [myid:3] - INFO  [main:FileSnap@83] - Reading snapshot /opt/data/zookeeper/version-2/snapshot.1900356f19
2023-05-07 10:33:58,966 [myid:3] - ERROR [main:Util@239] - Last transaction was partial.
2023-05-07 10:33:58,968 [myid:3] - ERROR [main:QuorumPeer@648] - Unable to load database on disk
java.io.IOException: The accepted epoch, 19 is less than the current epoch, 3a
	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)
2023-05-07 10:33:58,970 [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: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, 19 is less than the current epoch, 3a
	at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:645)
	... 4 more
[root@slave-2 bin]# 

解决办法:

将zookeeper的version-2目录备份了一份,再重新创建一个新的version-2目录,然后重新启动zookeeper。

操作如下:

复制代码
[root@slave-2 zookeeper]# ll
total 28
-rw-r--r-- 1 root root     2 Aug 30  2022 myid
drwxr-xr-x 2 root root 24576 May  7 10:36 version-2
-rw-r--r-- 1 root root     5 May  7 10:42 zookeeper_server.pid
[root@slave-2 zookeeper]# mv version-2 version-2.bak
[root@slave-2 zookeeper]# ll
total 28
-rw-r--r-- 1 root root     2 Aug 30  2022 myid
drwxr-xr-x 2 root root 24576 May  7 10:36 version-2.bak
-rw-r--r-- 1 root root     5 May  7 10:42 zookeeper_server.pid
[root@slave-2 zookeeper]# mkdir version-2
[root@slave-2 zookeeper]# ll
total 28
-rw-r--r-- 1 root root     2 Aug 30  2022 myid
drwxr-xr-x 2 root root     6 May  7 10:44 version-2
drwxr-xr-x 2 root root 24576 May  7 10:36 version-2.bak
-rw-r--r-- 1 root root     5 May  7 10:42 zookeeper_server.pid

然后重新启动zookeeper:

复制代码
[root@slave-2 bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@slave-2 bin]# netstat -tlunp|grep 2181
tcp6       0      0 :::2181                 :::*                    LISTEN      32695/java

备注:本文为迁移博文,非近期遇到的故障

相关推荐
消失在人海中31 分钟前
把Excel数据文件导入到Oracle数据库
数据库·oracle·excel
Kookoos2 小时前
ABP vNext + EF Core 实战性能调优指南
数据库·后端·c#·.net·.netcore
LLLLLindream2 小时前
Redis-商品缓存
数据库·redis·缓存
柃歌2 小时前
【LeetCode Solutions】LeetCode 176 ~ 180 题解
数据结构·数据库·sql·算法·leetcode
一眼青苔3 小时前
如何在MySQL中实现类似Redis的PING命令的功能来检测连接状态?
数据库·redis·mysql
奔驰的小野码3 小时前
SpringAI实现AI应用-使用redis持久化聊天记忆
java·数据库·人工智能·redis·spring
hweiyu003 小时前
MySQL性能分析工具:SHOW PROCESSLIST
数据库·mysql
vvilkim5 小时前
SQL语言基础:从入门到掌握结构化查询语言
数据库·sql·oracle
Sahas10195 小时前
debian安装docker
docker·eureka·debian