本文介绍了卡夫卡中没有匹配侦听器错误的领导者经纪人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此卡夫卡错误是什么意思?
What is the meaning of this kafka error ?
我在运行时得到它:
./kafka-console-consumer.sh --topic topicname --bootstrap-server localhost:9094
当尝试阅读本主题时,我在golang程序中遇到一些错误:
And I'm getting some errors inside a golang program when trying to read this topic:
代码段:
conn, err := kafka.DialLeader(context.Background(), "tcp", ip, getTopic(topic), 0)
if err != nil {
log.Println("ReadOffsetWithRetryOnError conn error: <", err, "> ", ip, " topic:", topic)
}
这很奇怪,因为在阅读不同主题时,它同时运行良好.
This is quite weird because, when reading on different topic it is working fine at the same time.
更多错误日志:
推荐答案
如果您尝试运行多个使用者并且kafka主题仅包含一个分区,也会发生此错误.通常,一个使用者应映射一个分区.如果您使用两个使用者,那么kafka主题中应该有2个分区.
This error also happens if you try to run multiple consumers and the kafka topic contains only one partition. Generally one consumer should mapped with one partition. If you are using two consumers then you should have 2 partition in the kafka topic.
这篇关于卡夫卡中没有匹配侦听器错误的领导者经纪人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!