IllegalArgumentException: requirement failed: Corrupt index found

Federico發表於2017-06-30

今天突然接到客戶反映線上伺服器傳送訊息異常,登入伺服器檢視是kafka服務出現了問題,想重啟一下服務,結果重啟出現一下報錯

[2017-06-30 19:29:13,708] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)
java.lang.IllegalArgumentException: requirement failed: Corrupt index found, index file (/data/apps/log/kafka/metrics-topic-13/00000000000000000000.index) has non-zero size but the last offset is 0 and the base offset is 0
    at scala.Predef$.require(Predef.scala:219)
    at kafka.log.OffsetIndex.sanityCheck(OffsetIndex.scala:352)
    at kafka.log.Log$$anonfun$loadSegments$5.apply(Log.scala:184)
    at kafka.log.Log$$anonfun$loadSegments$5.apply(Log.scala:183)
    at scala.collection.Iterator$class.foreach(Iterator.scala:750)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1202)
    at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
    at kafka.log.Log.loadSegments(Log.scala:183)
    at kafka.log.Log.<init>(Log.scala:67)
    at kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$3$$anonfun$apply$7$$anonfun$apply$1.apply$mcV$sp(LogManager.scala:142)
    at kafka.utils.Utils$$anon$1.run(Utils.scala:54)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
[2017-06-30 19:29:13,711] INFO [Kafka Server 2], shutting down (kafka.server.KafkaServer) 
 
解決方法如下:
find kafka-logs/  -size 10485760c -name *.index
將以上命令中搜尋到的所有檔案刪除,在重啟kafka,kafka會重新生成相應的檔案,詢問研發人員說刪除的資料不會對線上服務造成影響,但是如果你也碰到了這種問題最好還是要先問問你們部門的研發人員,在做相關的操作
 
 

相關文章