kafka服务器未开始显示错误

时间:2019-05-08 02:44:34

标签: c# apache-kafka

我是使用C#的kafka新手。之前运行良好。但是现在卡夫卡服务器崩溃并出现以下错误。

Error : 
Error while renaming dir for 46_HAQ-0 in log dir D:\tmp\kafka-logs (kafka.server.LogDirFailureChannel)
java.nio.file.AccessDeniedException: D:\tmp\kafka-logs\46_HAQ-0 -> D:\tmp\kafka-logs\46_HAQ-0.e77858d11274489887d14b1b0407cd44-delete
        at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
        at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
        at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:395)
        at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:288)
        at java.base/java.nio.file.Files.move(Files.java:1421)
        at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:809)
        at kafka.log.Log.$anonfun$renameDir$2(Log.scala:759)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at kafka.log.Log.maybeHandleIOException(Log.scala:1996)
        at kafka.log.Log.renameDir(Log.scala:757)
        at kafka.log.LogManager.asyncDelete(LogManager.scala:842)
        at kafka.cluster.Partition.$anonfun$delete$1(Partition.scala:353)
        at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:251)
        at kafka.utils.CoreUtils$.inWriteLock(CoreUtils.scala:259)
        at kafka.cluster.Partition.delete(Partition.scala:347)
        at kafka.server.ReplicaManager.stopReplica(ReplicaManager.scala:350)
        at kafka.server.ReplicaManager.$anonfun$stopReplicas$2(ReplicaManager.scala:380)
        at scala.collection.Iterator.foreach(Iterator.scala:937)
        at scala.collection.Iterator.foreach$(Iterator.scala:937)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
        at scala.collection.IterableLike.foreach(IterableLike.scala:70)
        at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
        at kafka.server.ReplicaManager.stopReplicas(ReplicaManager.scala:378)
        at kafka.server.KafkaApis.handleStopReplicaRequest(KafkaApis.scala:200)
        at kafka.server.KafkaApis.handle(KafkaApis.scala:111)
        at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:69)
        at java.base/java.lang.Thread.run(Thread.java:834)
        Suppressed: java.nio.file.AccessDeniedException: D:\tmp\kafka-logs\46_HAQ-0 -> D:\tmp\kafka-logs\46_HAQ-0.e77858d11274489887d14b1b0407cd44-delete
                at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
                at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
                at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:309)
                at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:288)
                at java.base/java.nio.file.Files.move(Files.java:1421)
                at org.apache.kafka.common.utils.Utils.atomicMoveWithFallback(Utils.java:806)


stopped moving logs for partitions  because they are in the failed log directory D:\tmp\kafka-logs. (kafka.server.ReplicaManager)
[2019-05-08 08:05:00,598] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions Set() (kafka.server.ReplicaFetcherManager)
[2019-05-08 08:05:00,598] INFO Stopping serving logs in dir D:\tmp\kafka-logs (kafka.log.LogManager)
[2019-05-08 08:05:00,601] INFO [ReplicaAlterLogDirsManager on broker 0] Removed fetcher for partitions Set() (kafka.server.ReplicaAlterLogDirsManager)
[2019-05-08 08:05:00,608] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions Set(46_HAQ-0) (kafka.server.ReplicaFetcherManager)
[2019-05-08 08:05:00,608] INFO [ReplicaAlterLogDirsManager on broker 0] Removed fetcher for partitions Set(46_HAQ-0) (kafka.server.ReplicaAlterLogDirsManager)
[2019-05-08 08:05:00,612] ERROR Shutdown broker because all log dirs in D:\tmp\kafka-logs have failed (kafka.log.LogManager.

我多次遇到此问题。

1 个答案:

答案 0 :(得分:0)

帮助我摆脱这个问题的是删除zookeeper数据文件夹和kafka日志文件夹。

这是Windows计算机上的以下文件夹:

1)我的C:/(zookeeper-home-dir)/conf/zoo.cfg文件具有 dataDir = C:\ zookeeper-3.4.14 \ data设置,该设置转换为创建该设置Zookeeper启动时的数据文件夹: C:/(Zookeeper-home)/bin/zookeeper-3.4.14data

2)我的C:/(kafka-home-dir)/config/server.properties文件具有 log.dirs = C:\ kafka_2.11-2.2.0 \ kafka-logs设置,因此在Kafka启动时,将创建以下日志文​​件夹: C:/((Kafka-home)/kafka_2.11-2.2.0kafka-logs