卡夫卡中没有匹配侦听器错误的领导者经纪人 [英] Leader brokers without a matching listener error in kafka

查看:104
本文介绍了卡夫卡中没有匹配侦听器错误的领导者经纪人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此卡夫卡错误是什么意思?

What is the meaning of this kafka error ?

[2018-08-22 11:40:49,429]警告[Consumer clientId = consumer-1, groupId = console-consumer-62114] 1个分区具有领导者经纪人 没有匹配的侦听器,包括[topicname-0] (org.apache.kafka.clients.NetworkClient)

[2018-08-22 11:40:49,429] WARN [Consumer clientId=consumer-1, groupId=console-consumer-62114] 1 partitions have leader brokers without a matching listener, including [topicname-0] (org.apache.kafka.clients.NetworkClient)

我在运行时得到它:

./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:

2018/08/22 11:44:12 ReadOffsetWithRetryOnError conn错误:<拨打tcp :0:连接:连接被拒绝> kafka0:9094主题:0

2018/08/22 11:44:12 ReadOffsetWithRetryOnError conn error: < dial tcp :0: connect: connection refused > kafka0:9094 topic: 0

代码段:

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-topics.sh-描述--zookeeper本地主机:2181 --topic topicname主题:indexBlock PartitionCount:1
ReplicationFactor:1配置: 主题:topicname分区:0领导者:-1复制:1002 Isr:1002

/kafka-topics.sh --describe --zookeeper localhost:2181 --topic topicname Topic:indexBlock PartitionCount:1
ReplicationFactor:1 Configs: Topic: topicname Partition: 0 Leader: -1 Replicas: 1002 Isr: 1002

推荐答案

[2018-08-22 11:40:49,429]警告[Consumer clientId = consumer-1,groupId = console-consumer-62114] 1个分区的领导者经纪人没有匹配的侦听器,包括[topicname-0](org .apache.kafka.clients.NetworkClient)

[2018-08-22 11:40:49,429] WARN [Consumer clientId=consumer-1, groupId=console-consumer-62114] 1 partitions have leader brokers without a matching listener, including [topicname-0] (org.apache.kafka.clients.NetworkClient)

如果您尝试运行多个使用者并且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.

这篇关于卡夫卡中没有匹配侦听器错误的领导者经纪人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆