Kafka无法在Windows上启动 - 找不到密钥:\ tmp \ kafka-logs

时间:2014-05-29 19:31:06

标签: windows apache-kafka

我已经付出了一些努力让Kafka在Windows 32上运行(公司发行的笔记本电脑 - 肯定不是我的选择......)。

我成功地创建了一些主题。但是在停止/重启kafka之后,它无法重新阅读这些主题。这是启动日志

[2014-05-29 12:26:23,097] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions [vip_ips_alerts,0],[calls,0],[dropped_calls,0],[calls_online,0],[calls_no_phone,0] (kafka.server.ReplicaFetcherManager)
[2014-05-29 12:26:23,106] ERROR [KafkaApi-0] error when handling request Name:LeaderAndIsrRequest;Version:0;Controller:0;ControllerEpoch:4;CorrelationId:5;ClientId:id_0-host_null-port_9092;Leaders:id:0,host:S80035683-SC01.mycompany.com,port:9092;PartitionState:(vip_ips_alerts,0) -> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:3,ControllerEpoch:4),ReplicationFactor:1),AllReplicas:0),(calls,0) -> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:1,ControllerEpoch:4),ReplicationFactor:1),AllReplicas:0),(dropped_calls,0) -> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:3,ControllerEpoch:4),ReplicationFactor:1),AllReplicas:0),(calls_online,0) -> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:3,ControllerEpoch:4),ReplicationFactor:1),AllReplicas:0),(calls_no_phone,0) -> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:3,ControllerEpoch:4),ReplicationFactor:1),AllReplicas:0) (kafka.server.KafkaApis)
java.util.NoSuchElementException: key not found: \tmp\kafka-logs
        at scala.collection.MapLike$class.default(MapLike.scala:225)
        at scala.collection.immutable.Map$Map1.default(Map.scala:107)
        at scala.collection.MapLike$class.apply(MapLike.scala:135)
        at scala.collection.immutable.Map$Map1.apply(Map.scala:107)
        at kafka.cluster.Partition.getOrCreateReplica(Partition.scala:91)
        at kafka.cluster.Partition$$anonfun$makeLeader$2.apply(Partition.scala:175)
        at kafka.cluster.Partition$$anonfun$makeLeader$2.apply(Partition.scala:175)
        at scala.collection.immutable.Set$Set1.foreach(Set.scala:86)
        at kafka.cluster.Partition.makeLeader(Partition.scala:175)
        at kafka.server.ReplicaManager$$anonfun$makeLeaders$5.apply(ReplicaManager.scala:305)
        at kafka.server.ReplicaManager$$anonfun$makeLeaders$5.apply(ReplicaManager.scala:304)
        at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:95)
        at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:95)
        at scala.collection.Iterator$class.foreach(Iterator.scala:772)
        at scala.collection.mutable.HashTable$$anon$1.foreach(HashTable.scala:157)
        at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:190)
        at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:45)
        at scala.collection.mutable.HashMap.foreach(HashMap.scala:95)
        at kafka.server.ReplicaManager.makeLeaders(ReplicaManager.scala:304)
        at kafka.server.ReplicaManager.becomeLeaderOrFollower(ReplicaManager.scala:258)
        at kafka.server.KafkaApis.handleLeaderAndIsrRequest(KafkaApis.scala:100)
        at kafka.server.KafkaApis.handle(KafkaApis.scala:72)
        at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:42)
        at java.lang.Thread.run(Thread.java:744)

现在我可以删除/重新创建主题。作为调查的一部分,我实际上已经多次这样做了(例如确保没有Zookeeper损坏),如果有关如何在这个过时的操作系统上获得kafka服务器的任何提示将不胜感激。

1 个答案:

答案 0 :(得分:2)

错误解释log.dir是unix和windows中kafka痛苦的巨大根源。

  

似乎异常是由以下声明引起的   划分。 replicaManager.highWatermarkCheckpoints(log.dir.getParent)   它试图在highWatermarkCheckpoint文件的地图中查找   键“\ kafka8-tmp \ kafka-logs”,但它不存在。我们注册   使用log.dirs中的属性值的键。

source

确保你没有尾部斜杠,并且new java.io.File("\tmp\kafka-logs").getParent没有失真(我旁边没有Windows机器可以自己找出所有这些前/后斜线)。