[Solved] Kafka Start Log Error: WARN Found a corrupted index file due to requirement failed: Corrupt index found

Go straight to the theme, and the personal test is effective!!

Error content

WARN Found a corrupted index file due to requirement failed: Corrupt index found   A corrupt index file was found and the request failed

WARN Found a corrupted index file due to requirement failed: Corrupt index found, index file (/tmp/kafka-logs/__consumer_offsets-13/00000000000000000000.index) has non-zero size but the last offset is 0 which is no larger than the base offset 0.}. deleting /tmp/kafka-logs/__consumer_offsets-13/00000000000000000000.timeindex, /tmp/kafka-logs/__consumer_offsets-13/00000000000000000000.index, and /tmp/kafka-logs/__consumer_offsets-13/00000000000000000000.txnindex and rebuilding index... (kafka.log.Log)
[2021-11-27 10:02:24,168] INFO Recovering unflushed segment 0 in log __consumer_offsets-13. (kafka.log.Log)
[2021-11-27 10:02:24,168] INFO Loading producer state from offset 0 for partition __consumer_offsets-13 with message format version 2 (kafka.log.Log)
[2021-11-27 10:02:24,169] INFO Completed load of log __consumer_offsets-13 with 1 log segments, log start offset 0 and log end offset 0 in 2 ms (kafka.log.Log)
[2021-11-27 10:02:24,172] WARN Found a corrupted index file due to requirement failed: Corrupt index found, index file (/tmp/kafka-logs/test-0/00000000000000000000.index) has non-zero size but the last offset is 0 which is no larger than the base offset 0.}. deleting /tmp/kafka-logs/test-0/00000000000000000000.timeindex, /tmp/kafka-logs/test-0/00000000000000000000.index, and /tmp/kafka-logs/test-0/00000000000000000000.txnindex and rebuilding index... (kafka.log.Log)

Error reporting reason

The Kafka broker is abnormally closed and stopped, resulting in index corruption

Solutions

Step 1:   Enter the Kafka home directory of your installation and execute the following command to view the storage directory of Kafka data (Kafka log configuration)

vim config/server.properties

Step 2: directly delete the/TMP/Kafka LOHS folder

rm -rf /tmp/kafka-logs/

Result verification

Restart Kafka and check the log to verify that the problem has been solved

Check the Kafka log and confirm that the error has been resolved


To solve the problem, a problem is derived

deleting the Kafka data file is equivalent to starting Kafka for the first time. When you start up with the zookeeper provided by Kafka, you may report an error by viewing logs/zookeeper.out under the log information.

Read More: