欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

zookeeper无法启动"Unable to load database on disk

程序员文章站 2022-06-29 22:59:24
QuorumPeerMain,ResourceManager都没有起来 resourcemanager.log如下 发现连接不上zookeeer,从 中得知s103,s104的QuorumPeerMain没启动,去s103的~/zookeeper/zookeeper.out查看日志,发现 //快照日 ......

quorumpeermain,resourcemanager都没有起来
resourcemanager.log如下

2018-09-28 23:17:02,787 fatal org.apache.hadoop.yarn.server.resourcemanager.resourcemanager: error starting resourcemanager
org.apache.hadoop.service.servicestateexception: org.apache.zookeeper.keeperexception$connectionlossexception: keepererrorcode = connectionloss
        at org.apache.hadoop.service.servicestateexception.convert(servicestateexception.java:59)
        at org.apache.hadoop.service.abstractservice.init(abstractservice.java:172)
        at org.apache.hadoop.service.compositeservice.serviceinit(compositeservice.java:107)
        at org.apache.hadoop.yarn.server.resourcemanager.adminservice.serviceinit(adminservice.java:142)
        at org.apache.hadoop.service.abstractservice.init(abstractservice.java:163)
        at org.apache.hadoop.service.compositeservice.serviceinit(compositeservice.java:107)
        at org.apache.hadoop.yarn.server.resourcemanager.resourcemanager.serviceinit(resourcemanager.java:267)
        at org.apache.hadoop.service.abstractservice.init(abstractservice.java:163)
        at org.apache.hadoop.yarn.server.resourcemanager.resourcemanager.main(resourcemanager.java:1185)
caused by: org.apache.zookeeper.keeperexception$connectionlossexception: keepererrorcode = connectionloss
        at org.apache.zookeeper.keeperexception.create(keeperexception.java:99)
        at org.apache.hadoop.ha.activestandbyelector$watcherwithclientref.waitforzkconnectionevent(activestandbyelector.java:1061)
        at org.apache.hadoop.ha.activestandbyelector$watcherwithclientref.access$400(activestandbyelector.java:1032)
        at org.apache.hadoop.ha.activestandbyelector.getnewzookeeper(activestandbyelector.java:636)
        at org.apache.hadoop.ha.activestandbyelector.createconnection(activestandbyelector.java:775)
        at org.apache.hadoop.ha.activestandbyelector.<init>(activestandbyelector.java:229)
        at org.apache.hadoop.yarn.server.resourcemanager.embeddedelectorservice.serviceinit(embeddedelectorservice.java:92)
        at org.apache.hadoop.service.abstractservice.init(abstractservice.java:163)
        ... 7 more

发现连接不上zookeeer,从xcall.sh jps中得知s103,s104的quorumpeermain没启动,去s103的~/zookeeper/zookeeper.out查看日志,发现

2018-09-29 03:40:56,375 [myid:103] - error [main:quorumpeer@692] - unable to load database on disk
java.io.ioexception: found ^@^@^@ in /home/centos/zookeeper/version-2/acceptedepoch
        at org.apache.zookeeper.server.quorum.quorumpeer.readlongfromfile(quorumpeer.java:1362)
        at org.apache.zookeeper.server.quorum.quorumpeer.loaddatabase(quorumpeer.java:677)
        at org.apache.zookeeper.server.quorum.quorumpeer.start(quorumpeer.java:635)
        at org.apache.zookeeper.server.quorum.quorumpeermain.runfromconfig(quorumpeermain.java:170)
        at org.apache.zookeeper.server.quorum.quorumpeermain.initializeandrun(quorumpeermain.java:114)
        at org.apache.zookeeper.server.quorum.quorumpeermain.main(quorumpeermain.java:81)

datadir=/home/centos/zookeeper //快照日志,在conf/zoo.cfg下,事务日志和快照日志位于相同目录
zookeeper.log.dir=. //log4j日志:记录zokeeper的健康状态,在conf/log4j.properties下
参考

解决方法:zookeeper无法启动"unable to load database on disk"