自己的虚拟机集群。一次强制关机后,发现slave2的zookeeper起不来了
http://blog.csdn.net/ashic/article/details/47088299
下午5点29:53.411 INFO org.apache.zookeeper.server.quorum.QuorumPeerConfig
Reading configuration from: /var/run/cloudera-scm-agent/process/517-zookeeper-server/zoo.cfg
下午5点29:53.420 INFO org.apache.zookeeper.server.quorum.QuorumPeerConfig
Defaulting to majority quorums
下午5点29:53.423 INFO org.apache.zookeeper.server.DatadirCleanupManager
autopurge.snapRetainCount set to 5
下午5点29:53.424 INFO org.apache.zookeeper.server.DatadirCleanupManager
autopurge.purgeInterval set to 24
下午5点29:53.430 INFO org.apache.zookeeper.server.DatadirCleanupManager
Purge task started.
下午5点29:53.434 ERROR org.apache.zookeeper.server.DatadirCleanupManager
Error occured while purging.
org.apache.zookeeper.server.persistence.FileTxnSnapLog$DatadirException: Missing data directory /var/lib/zookeeper/version-2, automatic data directory creation is disabled (zookeeper.datadir.autocreate is false). Please create this directory manually.
at org.apache.zookeeper.server.persistence.FileTxnSnapLog.<init>(FileTxnSnapLog.java:102)
at org.apache.zookeeper.server.PurgeTxnLog.purge(PurgeTxnLog.java:68)
at org.apache.zookeeper.server.DatadirCleanupManager$PurgeTask.run(DatadirCleanupManager.java:140)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
来源: http://192.168.40.205:7180/cmf/process/all/logs/context?
timestamp=1437989392521&port=9000&host=slave2.cloudera&path=%2Fvar%2Flog%2Fzookeeper%2Fzookeeper-cmf-zookeeper1-SERVER-slave2.cloudera.log&roleId=113
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
看了老外的文章。以下上是处理方法
more /etc/zookeeper/conf.dist/zoo.cfg
找到datadir
[root@slave2 zookeeper]# pwd
/var/lib/zookeeper
[root@slave2 zookeeper]# ls
myid version-2 version-2.bak
清空version-2文件夹下的全部文件