我们在 Windows 2012 R2 操作系统上运行 Kafka 2.12-2.4.1,并在我们的应用程序中用作消息源。我们发现,在 38 小时后,Kafka Broker 出现以下错误消息。我们发现删除所有 Kakfa 临时日志并重新启动 Kafka 代理可以解决此问题,但我们正在寻找永久解决方案,因为这需要每 38 小时后完成一次。
有人可以用他们的专业知识帮助我们吗?
[2020-05-10 04:07:53,435] ERROR Failed to clean up log for __consumer_offsets-9 in dir C:\kafka\temp\kafka-logs due to IOException (kafka.server.LogDirFailureChannel)
java.nio.file.FileSystemException: C:\kafka\temp\kafka-logs\__consumer_offsets-9\00000000000000000000.timeindex.cleaned -> C:\kafka\temp\kafka-logs\__consumer_offsets-9\00000000000
000000000.timeindex.swap: The process cannot access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileCopy.move(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.move(Unknown Source)
at java.nio.file.Files.move(Unknown Source)
at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:795)
at kafka.log.AbstractIndex.renameTo(AbstractIndex.scala:209)
at kafka.log.LogSegment.changeFileSuffixes(LogSegment.scala:497)
at kafka.log.Log.$anonfun$replaceSegments$4(Log.scala:2286)
at kafka.log.Log.$anonfun$replaceSegments$4$adapted(Log.scala:2286)
at scala.collection.immutable.List.foreach(List.scala:392)
at kafka.log.Log.replaceSegments(Log.scala:2286)
at kafka.log.Cleaner.cleanSegments(LogCleaner.scala:605)
at kafka.log.Cleaner.$anonfun$doClean$6(LogCleaner.scala:530)
at kafka.log.Cleaner.$anonfun$doClean$6$adapted(LogCleaner.scala:529)
at scala.collection.immutable.List.foreach(List.scala:392)
at kafka.log.Cleaner.doClean(LogCleaner.scala:529)
at kafka.log.Cleaner.clean(LogCleaner.scala:503)
at kafka.log.LogCleaner$CleanerThread.cleanLog(LogCleaner.scala:372)
at kafka.log.LogCleaner$CleanerThread.cleanFilthiestLog(LogCleaner.scala:345)
at kafka.log.LogCleaner$CleanerThread.tryCleanFilthiestLog(LogCleaner.scala:325)
at kafka.log.LogCleaner$CleanerThread.doWork(LogCleaner.scala:314)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:96)
Suppressed: java.nio.file.FileSystemException: C:\kafka\temp\kafka-logs\__consumer_offsets-9\00000000000000000000.timeindex.cleaned -> C:\kafka\temp\kafka-logs\__consumer_o
ffsets-9\00000000000000000000.timeindex.swap: The process cannot access the file because it is being used by another process.
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileCopy.move(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.move(Unknown Source)
at java.nio.file.Files.move(Unknown Source)
at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:792)
... 17 more