gpt4 book ai didi

windows - 由于未加载主题,Kafka 启动失败

转载 作者:可可西里 更新时间:2023-11-01 10:42:10 28 4
gpt4 key购买 nike

here 的帮助下,我在 Windows 机器上设置了 Kafka 服务器和 zookeeper .我成功地设置了一个主题 - MTETest,如下面的日志所示,生成并使用该主题的消息。

在尝试使用管理员命令提示符下安装附带的批处理文件停止和启动 Kafka 和 Zookeeper 时,我遇到了一个问题,即 kafka 服务器无法启动并显示以下消息 -

[2017-11-30 21:26:24,601] ERROR There was an error in one of the threads during logs loading: java.nio.file.FileSystemException: C:SourceKafkakafka_2.11-0.11.0.1\MTETest-0\00000000000000000000.timeindex: The process cannot access the file because it is being used by another process. (kafka.log.LogManager) [2017-11-30 21:26:24,603] FATAL [Kafka Server 0], Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) java.nio.file.FileSystemException: C:SourceKafkakafka_2.11-0.11.0.1\MTETest-0\00000000000000000000.timeindex: The process cannot access the file because it is being used by another process.

at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269) at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108) at java.nio.file.Files.deleteIfExists(Files.java:1165) at kafka.log.Log$$anonfun$loadSegmentFiles$3.apply(Log.scala:318) at kafka.log.Log$$anonfun$loadSegmentFiles$3.apply(Log.scala:279) at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733) at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33) at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186) at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732) at kafka.log.Log.loadSegmentFiles(Log.scala:279) at kafka.log.Log.loadSegments(Log.scala:383) at kafka.log.Log.(Log.scala:186) at kafka.log.Log$.apply(Log.scala:1609) at kafka.log.LogManager$$anonfun$loadLogs$2$$anonfun$5$$anonfun$apply$12$$anonfun$apply$1.apply$mcV$sp(LogManager.scala:172) at kafka.utils.CoreUtils$$anon$1.run(CoreUtils.scala:57) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) [2017-11-30 21:26:24,606] WARN Found a corrupted index file due to requirement failed: Corrupt index found, index file (C:\Source\Kafka\kafka_2.11-0.11.0.1\SourceKafkakafka_2.11-0.11.0.1\MTETestTopic-0\00000000000000000000.index) has non-zero size but the last offset is 0 which is no larger than the base offset 0.}. deleting C:\Source\Kafka\kafka_2.11-0.11.0.1\SourceKafkakafka_2.11-0.11.0.1\MTETestTopic-0\00000000000000000000.timeindex, C:\Source\Kafka\kafka_2.11-0.11.0.1\SourceKafkakafka_2.11-0.11.0.1\MTETestTopic-0\00000000000000000000.index, and C:\Source\Kafka\kafka_2.11-0.11.0.1\SourceKafkakafka_2.11-0.11.0.1\MTETestTopic-0\00000000000000000000.txnindex and rebuilding index... (kafka.log.Log) [2017-11-30 21:26:24,609] INFO [Kafka Server 0], shutting down (kafka.server.KafkaServer) [2017-11-30 21:26:24,613] INFO Terminate ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread) [2017-11-30 21:26:24,615] WARN Found a corrupted index file due to requirement failed: Corrupt index found, index file (C:\Source\Kafka\kafka_2.11-0.11.0.1\SourceKafkakafka_2.11-0.11.0.1__consumer_offsets-0\00000000000000000000.index) has non-zero size but the last offset is 0 which is no larger than the base offset 0.}. deleting C:\Source\Kafka\kafka_2.11-0.11.0.1\SourceKafkakafka_2.11-0.11.0.1__consumer_offsets-0\00000000000000000000.timeindex, C:\Source\Kafka\kafka_2.11-0.11.0.1\SourceKafkakafka_2.11-0.11.0.1__consumer_offsets-0\00000000000000000000.index, and C:\Source\Kafka\kafka_2.11-0.11.0.1\SourceKafkakafka_2.11-0.11.0.1__consumer_offsets-0\00000000000000000000.txnindex and rebuilding index... (kafka.log.Log) [2017-11-30 21:26:24,616] INFO Session: 0x1600d98747a0001 closed (org.apache.zookeeper.ZooKeeper) [2017-11-30 21:26:24,623] INFO EventThread shut down for session: 0x1600d98747a0001 (org.apache.zookeeper.ClientCnxn) [2017-11-30 21:26:24,625] INFO [Kafka Server 0], shut down completed (kafka.server.KafkaServer) [2017-11-30 21:26:24,626] FATAL Exiting Kafka. (kafka.server.KafkaServerStartable) [2017-11-30 21:26:24,628] INFO [Kafka Server 0], shutting down (kafka.server.KafkaServer)

我已尝试根据类似问题中的建议将设置 - delete.topic.enable 更改为 true here在 kafka server.properties 中,但它没有帮助。另外,我没有手动打开主题或其相关文件。任何人都遇到过这个问题,请帮助。这个问题是 Windows 特有的吗?

当我删除由 Kafka 创建的主题及其相关物理文件夹时,它加载成功,但它不是正确的。请提出正确的解决方案。谢谢。

最佳答案

根据报错信息:

 The process cannot access the file because it is being used by another process.

你有另一个进程已经在使用这个文件,它正在阻止 Kafka 启动。参见 https://serverfault.com/questions/1966/how-do-you-find-what-process-is-holding-a-file-open-in-windows寻找过程

关于windows - 由于未加载主题,Kafka 启动失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47577812/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com