메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.


아래와 같은 내용의 오류가 발생하면서 zookeeper 데몬이 실행되지 않는 경우가 있는데 이는 마지막 transaction log파일에 문제가 발생하여 읽지 못해서 발생하는 오류임.

먼저 dataDir(예, /var/lib/zookeeper)로 지정된 위치의 version-2폴더로 이동한다.

마지막의 log파일과 snapshot파일을 지우고 파일 크기가 0인 log파일도 삭제하고 zookeeper를 재기동하면 정상적으로 데몬이 기동되며 현재의 log및 snapshot를 새롭게 생성한것을 확인할 수 있다.


----- 수행 명령문 예시

gooper@gsda1:/var/lib/zookeeper/version-2$ sudo rm log.19000a12e6 snapshot.19000a12e5

gooper@gsda1:/var/lib/zookeeper/version-2$ sudo rm log.19000a2c4e


-----------------오류발생시의 파일------------------

-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 13 17:27 log.1900040c76

-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 16 05:25 log.1900054051

-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 19 21:23 log.1900061d04

-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 24 06:49 log.1900076140

-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 27 17:00 log.190008e4b7

-rw-r--r-- 1 zookeeper zookeeper 67108880 Aug  1 13:07 log.19000a12e6

-rw-r--r-- 1 zookeeper zookeeper        0 Aug  1 21:08 log.19000a2c4e

-rw-r--r-- 1 zookeeper zookeeper 11662886 Jul 13 17:27 snapshot.190005404f

-rw-r--r-- 1 zookeeper zookeeper 11662889 Jul 16 05:25 snapshot.1900061d03

-rw-r--r-- 1 zookeeper zookeeper 11662893 Jul 19 21:23 snapshot.190007613f

-rw-r--r-- 1 zookeeper zookeeper 11662834 Jul 24 06:49 snapshot.190008e4b7

-rw-r--r-- 1 zookeeper zookeeper 11662882 Jul 27 17:00 snapshot.19000a12e5


---------------조치후의 파일-----------
drwxr-xr-x 2 zookeeper zookeeper     4096 Aug  3 10:49 .
drwxr-xr-x 4 zookeeper zookeeper     4096 Jun  8 15:36 ..
-rw-r--r-- 1 zookeeper zookeeper        2 Aug  3 10:49 acceptedEpoch
-rw-r--r-- 1 zookeeper zookeeper        2 Aug  3 10:49 currentEpoch
-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 13 17:27 log.1900040c76
-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 16 05:25 log.1900054051
-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 19 21:23 log.1900061d04
-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 24 06:49 log.1900076140
-rw-r--r-- 1 zookeeper zookeeper 67108880 Jul 27 17:00 log.190008e4b7
-rw-r--r-- 1 zookeeper zookeeper 67108880 Aug  3 10:55 log.1f00003cfc
-rw-r--r-- 1 zookeeper zookeeper 11662886 Jul 13 17:27 snapshot.190005404f
-rw-r--r-- 1 zookeeper zookeeper 11662889 Jul 16 05:25 snapshot.1900061d03
-rw-r--r-- 1 zookeeper zookeeper 11662893 Jul 19 21:23 snapshot.190007613f
-rw-r--r-- 1 zookeeper zookeeper 11662834 Jul 24 06:49 snapshot.190008e4b7
-rw-r--r-- 1 zookeeper zookeeper 11663132 Aug  3 10:49 snapshot.1f00003cfb


-------------------------------------오류내용------------------------------------------

10:20:40.395 AMINFOFileSnap

Reading snapshot /var/lib/zookeeper/version-2/snapshot.19000a12e5
10:20:40.920 AMERRORUtil
Last transaction was partial.
10:20:40.932 AMERRORQuorumPeer
Unable to load database on disk
java.io.EOFException
	at java.io.DataInputStream.readInt(DataInputStream.java:392)
	at org.apache.jute.BinaryInputArchive.readInt(BinaryInputArchive.java:63)
	at org.apache.zookeeper.server.persistence.FileHeader.deserialize(FileHeader.java:64)
	at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.inStreamCreated(FileTxnLog.java:595)
	at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.createInputArchive(FileTxnLog.java:614)
	at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.goToNextLog(FileTxnLog.java:580)
	at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.next(FileTxnLog.java:662)
	at org.apache.zookeeper.server.persistence.FileTxnSnapLog.restore(FileTxnSnapLog.java:204)
	at org.apache.zookeeper.server.ZKDatabase.loadDataBase(ZKDatabase.java:223)
	at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:530)
	at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:520)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:167)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:79)
10:20:40.945 AMERRORQuorumPeerMain
Unexpected exception, exiting abnormally
java.lang.RuntimeException: Unable to run quorum server 
	at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:578)
	at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:520)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:167)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:79)
Caused by: java.io.EOFException
	at java.io.DataInputStream.readInt(DataInputStream.java:392)
	at org.apache.jute.BinaryInputArchive.readInt(BinaryInputArchive.java:63)
	at org.apache.zookeeper.server.persistence.FileHeader.deserialize(FileHeader.java:64)
	at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.inStreamCreated(FileTxnLog.java:595)
	at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.createInputArchive(FileTxnLog.java:614)
	at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.goToNextLog(FileTxnLog.java:580)
	at org.apache.zookeeper.server.persistence.FileTxnLog$FileTxnIterator.next(FileTxnLog.java:662)
	at org.apache.zookeeper.server.persistence.FileTxnSnapLog.restore(FileTxnSnapLog.java:204)
	at org.apache.zookeeper.server.ZKDatabase.loadDataBase(ZKDatabase.java:223)
	at org.apache.zookeeper.server.quorum.QuorumPeer.loadDataBase(QuorumPeer.java:530)
	... 4 more
위로