gpt4 book ai didi

apache-zookeeper - Kafka 消费者启动错误 : Failed to add leader for partitions [calls, 0] - NotLeaderForPartitionException

转载 作者:行者123 更新时间:2023-12-04 11:33:18 25 4
gpt4 key购买 nike

注意:这是针对旧版本的:我们正在运行 kafka_2.9.2-0.8.1

当尝试针对 windows7 上的现有主题运行 kafka-console-consumer.bat 时,我们收到“无法添加领导者”和“NotLeaderForPartition”异常

这是命令行

set GROUP=group1234
kafka-console-consumer.bat --group %GROUP% --zookeeper localhost:2181 --topic calls --from-beginning

以下是错误:
[2014-05-26 15:02:12,997] WARN [group1234_S80035683-SC01-1401141732400-98745e28-leader-finder-thread], Failed to add leader for partitions [calls,0];
will retry (kafka.consumer.ConsumerFetcherManager$LeaderFinderThread:89)
kafka.common.NotLeaderForPartitionException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at kafka.common.ErrorMapping$.exceptionFor(ErrorMapping.scala:73)
at kafka.consumer.SimpleConsumer.earliestOrLatestOffset(SimpleConsumer.scala:160)
at kafka.consumer.ConsumerFetcherThread.handleOffsetOutOfRange(ConsumerFetcherThread.scala:60)
at kafka.server.AbstractFetcherThread$$anonfun$addPartitions$2.apply(AbstractFetcherThread.scala:179)
at kafka.server.AbstractFetcherThread$$anonfun$addPartitions$2.apply(AbstractFetcherThread.scala:174)
at scala.collection.immutable.Map$Map1.foreach(Map.scala:119)
at kafka.server.AbstractFetcherThread.addPartitions(AbstractFetcherThread.scala:174)
at kafka.server.AbstractFetcherManager$$anonfun$addFetcherForPartitions$2.apply(AbstractFetcherManager.scala:86)
at kafka.server.AbstractFetcherManager$$anonfun$addFetcherForPartitions$2.apply(AbstractFetcherManager.scala:76)
at scala.collection.immutable.Map$Map1.foreach(Map.scala:119)
at kafka.server.AbstractFetcherManager.addFetcherForPartitions(AbstractFetcherManager.scala:76)

我们最终无法消费任何消息。

我们正在运行 kafka_2.9.2-0.8.1

注意:Zookeeper 看到 Consumer 尝试连接:我进入 zkCli 并且可以看到新的 group1234
[zk: localhost:2181(CONNECTED) 2] ls2 /consumers/group1234
[owners, ids]
cZxid = 0x123
ctime = Mon May 26 15:02:12 PDT 2014
mZxid = 0x123
mtime = Mon May 26 15:02:12 PDT 2014
pZxid = 0x128
cversion = 2
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 2

这是有关请求的信息 电话 ZK中的主题:
[zk: localhost:2181(CONNECTED) 7] ls2 /brokers/topics/calls
[partitions]
cZxid = 0x18
ctime = Sat May 24 23:15:16 PDT 2014
mZxid = 0x18
mtime = Sat May 24 23:15:16 PDT 2014
pZxid = 0x1c
cversion = 1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 36
numChildren = 1

如果该主题有损坏,我只是将它放在 ZK 中,然后通过 kafka-topics.bat 重新创建它。这是新的 ZK 输出
[zk: localhost:2181(CONNECTED) 15] ls2 /brokers/topics/calls
[]
cZxid = 0x136
ctime = Mon May 26 16:02:51 PDT 2014
mZxid = 0x136
mtime = Mon May 26 16:02:51 PDT 2014
pZxid = 0x136
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 36
numChildren = 0

最佳答案

搜索显示,现在,7 年后,这不再是当前版本的已知问题。
还有多个补丁可以解决可能相同或不同的错误,并且几乎可以肯定其中一个解决了该问题。
因此,对于任何人来说,唯一实用的解决方案似乎是升级到更新的版本。 (对于 Kafka、Zookeeper 以及 Windows。)
如果问题在当前相关版本中仍然存在,请提出新问题,因为根本原因不太可能相同。

关于apache-zookeeper - Kafka 消费者启动错误 : Failed to add leader for partitions [calls, 0] - NotLeaderForPartitionException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23853224/

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