由于未加载主题,kafka在启动时失败

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

我已经在这里的帮助下在windows机器上安装了kafka服务器和zookeeper。我成功地在下面的日志中设置了一个topic-mtetest,生成并使用与这个主题相关的消息。
在尝试使用Administrator命令提示符中安装的批处理文件停止和启动kafka和zookeeper时,我遇到了kafka服务器无法启动的问题,消息如下-
[2017-11-30 21:26:24601]错误加载日志期间其中一个线程出错:java.nio.file.filesystemexception:c:sourcekafkakafka\u 2.11-0.11.0.1\mtetest-0\00000000000000000000.timeindex:进程无法访问该文件,因为另一个进程正在使用该文件(kafka.log.logmanager)[2017-11-30 21:26:24603]致命错误[kafka服务器0],kafkaserver启动时发生致命错误。准备关闭(kafka.server.kafkaserver)java.nio.file.filesystemexception:c:sourcekafkafka\u 2.11-0.11.0.1\mtetest-0\00000000000000000000.timeindex:进程无法访问该文件,因为另一个进程正在使用它。
在sun.nio.fs.windowsexception.translatetoioexception(windowsexception。java:86)在sun.nio.fs.windowsexception.rethrowasioexception(windowsexception。java:97)在sun.nio.fs.windowsexception.rethrowasioexception(windowsexception。java:102)在sun.nio.fs.windowsfilesystemprovider.impldelete(windowsfilesystemprovider。java:269)在sun.nio.fs.abstractfilesystemprovider.deleteifexists(abstractfilesystemprovider。java:108)在java.nio.file.files.deleteifexists(files。java:1165)在kafka.log.log$$anonfun$loadsegmentfiles$3.apply(log。scala:318)在kafka.log.log$$anonfun$loadsegmentfiles$3.apply(log。scala:279)在scala.collection.traversablelike$withfilter$$anonfun$foreach$1.apply(traversablelike。scala:733)在scala.collection.indexedseqoptimized$class.foreach(indexedseqoptimized。scala:33)在scala.collection.mutable.arrayops$ofref.foreach(arrayops。scala:186)在scala.collection.traversablelike$withfilter.foreach(traversablelike。scala:732)在kafka.log.log.loadsegmentfiles(日志。scala:279)在kafka.log.log.loadsegments(log。scala:383)在Kafka。scala:186)在kafka.log.log$.apply(log。scala:1609)在kafka.log.logmanager$$anonfun$loadlogs$2$$anonfun$5$$anonfun$apply$12$$anonfun$apply$1.apply$mcv$sp(logmanager)。scala:172)在kafka.utils.coreutils$$anon$1.run(coreutils。scala:57)在java.util.concurrent.executors$runnableadapter.call(executors。java:511)在java.util.concurrent.futuretask.run(futuretask。java:266)位于java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor。java:1149)在java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor。java:624)在java.lang.thread.run(线程。java:748) [2017-11-30 21:26:24606]警告由于要求失败而发现损坏的索引文件:发现损坏的索引,索引文件(c:\source\kafka\kafka\u 2.11-0.11.0.1\sourcekafkafka\u 2.11-0.11.0.1\mtetesttopic-0\00000000000000000000000000.index)大小非零,但最后一个偏移量为0,不大于基偏移量0。}。删除c:\source\kafka\kafka\u 2.11-0.11.0.1\sourcekafkafka\u 2.11-0.11.0.1\mtetesttopic-0\00000000000000000000.timeindex,c:\source\kafka\kafka\u 2.11-0.11.0.1\sourcekafkafka\u 2.11-0.11.0.1\mtetesttopic-0\00000000000000000000000000.index,和c:\source\kafka\kafka\u 2.11-0.11.0.1\sourcekafkafka\u 2.11-0.11.0.1\mtetesttopic-0\00000000000000000000.txn索引和重建索引(kafka.log.log)[2017-11-30 21:26:24609]信息[kafka服务器0],正在关闭(kafka.server.kafkaserver)[2017-11-30 21:26:24613]信息客户端事件线程(org.i0itec.zkclient.zkeventthread)[2017-11-30 21:26:24615]警告由于要求失败而发现损坏的索引文件:发现损坏的索引,索引文件(c:\source\kafka\kafka\u 2.11-0.11.0.1\sourcekafkafka\u 2.11-0.11.0.1\uu consumer\u offsets-0\000000000000000000000.index)大小非零,但最后一个偏移量为0,不大于基偏移量0。}。删除c:\source\kafka\kafka\u 2.11-0.11.0.1\sourcekafkafka\u 2.11-0.11.0.1\u consumer\u offsets-0\00000000000000000000.timeindex,c:\source\kafka\kafka\u 2.11-0.11.0.1\sourcekafkafka\u 2.11-0.11.0.1\u consumer\u offsets-0\00000000000000000000000000.index,和c:\source\kafka\kafka\u 2.11-0.11.0.1\sourcekafkafka\u 2.11-0.11.0.1\u消费者\u偏移量-0\00000000000000000000.txn索引和重建索引(kafka.log.log)[2017-11-30 21:26:24616]信息会话:0x1600d98747a0001关闭(org.apache.zookeeper.zookeeper)[2017-11-30 21:26:24623]信息事件线程关闭会话:0x1600d98747a0001(org.apache.zookeeper.clientcnxn)[2017-11-30 21:26:24625]信息[kafka服务器0],关闭完成(kafka.server.kafkaserver)[2017-11-30 21:26:24,626]Kafka死了(kafka.server.kafkaserverstartable)[2017-11-30 21:26:24628]信息[kafka server 0],正在关闭(kafka.server.kafkaserver)
我曾尝试根据kafka server.properties中类似问题的建议将设置delete.topic.enable更改为true,但没有任何帮助。另外,我没有手动打开主题或其相关文件。任何人面对这个问题,请帮助。这个问题是windows特有的吗?
当我删除由kafka创建的主题及其相关物理文件夹时,它会成功加载,但这不是正确的做法。请提出正确的解决方案。谢谢。

whlutmcx

whlutmcx1#

根据错误信息:

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 寻找过程

相关问题