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

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

问题描述

这个kafka错误是什么意思?

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 --describe --zookeeper 本地主机:2181 --topic主题名称主题:索引块分区计数:1
复制因子:1 配置:主题:topicname 分区:0 Leader:-1 Replicas: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] WARN [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.

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

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