Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zookeeper: java.io.IOException: No snapshot found, but there are log entries. Something is broken

I have been working with Kafka 2.4.0 (2.11) and yesterday I had to forcefully terminate the process for some unknown reason. Since then I haven't been unable to start Zookeeper due to the following error:

[2020-01-11 11:12:43,783] ERROR Unexpected exception, exiting abnormally (org.apache.zookeeper.server.ZooKeeperServerMain)
java.io.IOException: No snapshot found, but there are log entries. Something is broken!
    at org.apache.zookeeper.server.persistence.FileTxnSnapLog.restore(FileTxnSnapLog.java:222)
    at org.apache.zookeeper.server.ZKDatabase.loadDataBase(ZKDatabase.java:240)
    at org.apache.zookeeper.server.ZooKeeperServer.loadData(ZooKeeperServer.java:290)
    at org.apache.zookeeper.server.ZooKeeperServer.startdata(ZooKeeperServer.java:450)
    at org.apache.zookeeper.server.NIOServerCnxnFactory.startup(NIOServerCnxnFactory.java:764)
    at org.apache.zookeeper.server.ServerCnxnFactory.startup(ServerCnxnFactory.java:98)
    at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:144)
    at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:106)
    at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:128)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:82)

And as soon as I searched for this problem I found issue ZOOKEEPER-3513 reported, which may or may not explain the problem. However, what I'm finding strange is that if I delete the Kafka/Zookeeper directory and download it again from scratch, the problem persists. Does anyone know how I can solve this?

Thank you for your help

like image 590
João Matos Avatar asked Jan 11 '20 11:01

João Matos


4 Answers

Check for the tmp/zookeeper folder on the drive where you have kafka folder (lets say D:/), and delete the folder tmp, which will create automatically for you once run the zookeeper again.

like image 189
Veswanth Avatar answered Nov 12 '22 19:11

Veswanth


Try changing your zookeeper data directory. Your zookeeper data directory is defined in zookeeper.properties (I think the default is /tmp/zookeeper).

Perhaps you're not deleting the correct zookeeper directory?

I had the same problem, and this solution worked.

NOTE: I'm experimenting with Kafka, and not using it in production. I have no idea what else the above does, apart from fix this error...

like image 31
someguy99 Avatar answered Nov 12 '22 18:11

someguy99


I've faced the same issue with Zookeeper after updating from version 3.4.x to 3.5.6. As described here. I've:

  1. added empty snapshot.0 file in data directory
  2. added a property 'zookeeper.snapshot.trust.empty=true' to Zookeeper configuration file (default is zoo.cfg)
like image 6
Sergei Doroshenko Avatar answered Nov 12 '22 18:11

Sergei Doroshenko



On windows ->

Go to the tmp folder where the zookeeper details are stored and delete the existing log files

Directory path = d:\tmp\zookeeper\version-2


On Linux ->

Path = /tmp/zookeeper/version-2

And remove all the existing log files using rm -r log.1

The log files will be created automatically again and will resolve the issue.


like image 6
CodingBee Avatar answered Nov 12 '22 18:11

CodingBee