kafka代理在清理日志文件时关闭

1tuwyuhd  于 2021-06-07  发布在  Kafka
关注(0)|答案(1)|浏览(562)

Kafka集群3家券商(version:1.1.0)已经运行了6个多月了。
然后在2018/12/12之后,我们将每个主题的分区从3修改为48,然后代理每5-10天关闭一次。
然后我们将代理从1.1.0升级到2.1.0,但是代理仍然每5-10天关闭一次。
每次,一个代理在下面的错误日志之后关闭,然后几分钟后,另外两个代理也关闭,并且有相同的错误,但是有其他分区日志文件。

[2019-01-11 17:16:36,572] INFO [ProducerStateManager partition=__transaction_state-11] Writing producer snapshot at offset 807760 (kafka.log.ProducerStateManager)
[2019-01-11 17:16:36,572] INFO [Log partition=__transaction_state-11, dir=/kafka/logs] Rolled new log segment at offset 807760 in 4 ms. (kafka.log.Log)
[2019-01-11 17:16:46,150] WARN Resetting first dirty offset of __transaction_state-35 to log start offset 194404 since the checkpointed offset 194345 is invalid. (kafka.log.LogCleanerManager$)
[2019-01-11 17:16:46,239] ERROR Failed to clean up log for __transaction_state-11 in dir /kafka/logs due to IOException (kafka.server.LogDirFailureChannel)
java.nio.file.NoSuchFileException: /kafka/logs/__transaction_state-11/00000000000000807727.log
        at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
        at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
        at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:409)
        at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
        at java.nio.file.Files.move(Files.java:1395)
        at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:809)
        at org.apache.kafka.common.record.FileRecords.renameTo(FileRecords.java:222)
        at kafka.log.LogSegment.changeFileSuffixes(LogSegment.scala:488)
        at kafka.log.Log.asyncDeleteSegment(Log.scala:1838)
        at kafka.log.Log.$anonfun$replaceSegments$6(Log.scala:1901)
        at kafka.log.Log.$anonfun$replaceSegments$6$adapted(Log.scala:1896)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at kafka.log.Log.replaceSegments(Log.scala:1896)
        at kafka.log.Cleaner.cleanSegments(LogCleaner.scala:583)
        at kafka.log.Cleaner.$anonfun$doClean$6(LogCleaner.scala:515)
        at kafka.log.Cleaner.$anonfun$doClean$6$adapted(LogCleaner.scala:514)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at kafka.log.Cleaner.doClean(LogCleaner.scala:514)
        at kafka.log.Cleaner.clean(LogCleaner.scala:492)
        at kafka.log.LogCleaner$CleanerThread.cleanLog(LogCleaner.scala:353)
        at kafka.log.LogCleaner$CleanerThread.cleanFilthiestLog(LogCleaner.scala:319)
        at kafka.log.LogCleaner$CleanerThread.doWork(LogCleaner.scala:300)
        at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:82)
        Suppressed: java.nio.file.NoSuchFileException: /kafka/logs/__transaction_state-11/00000000000000807727.log -> /kafka/logs/__transaction_state-11/00000000000000807727.log.deleted
                at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
                at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
                at sun.nio.fs.UnixCopyFile.move(UnixCopyFile.java:396)
                at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262)
                at java.nio.file.Files.move(Files.java:1395)
                at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:806)
                ... 17 more
[2019-01-11 17:16:46,245] INFO [ReplicaManager broker=2] Stopping serving replicas in dir /kafka/logs (kafka.server.ReplicaManager)
[2019-01-11 17:16:46,314] INFO Stopping serving logs in dir /kafka/logs (kafka.log.LogManager)
[2019-01-11 17:16:46,326] ERROR Shutdown broker because all log dirs in /kafka/logs have failed (kafka.log.LogManager)
4zcjmb1e

4zcjmb1e1#

如果你没有改变 log.retention.bytes 或者 log.retention.hours 或者 log.retention.minutes 或者 log.retention.ms Kafka试图在7天后删除日志。所以基于这个例外,Kafka想要清理文件 /kafka/logs/__transaction_state-11/00000000000000807727.log 但是,kafka日志目录中没有这样的文件,它抛出了一个导致代理关闭的异常。
如果您能够关闭集群和zookeeper,请执行此操作并进行清理 /kafka/logs/__transaction_state-11 手动。
注意:我不知道它是否有害,但你可以按照安全删除Kafka主题帖子。

相关问题