Kafka控制台消费者中的Kafka引导服务器与Zookeeper [英] Kafka bootstrap-servers vs zookeeper in kafka-console-consumer

查看:124
本文介绍了Kafka控制台消费者中的Kafka引导服务器与Zookeeper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过3个经纪人&来测试运行单个Kafka节点动物园管理员.我希望使用控制台工具进行测试.我这样运行生产者:

I'm trying to test run a single Kafka node with 3 brokers & zookeeper. I wish to test using the console tools. I run the producer as such:

kafka-console-producer --broker-list localhost:9092,localhost:9093,localhost:9094 --topic testTopic

然后我像这样运行消费者:

Then I run the consumer as such:

kafka-console-consumer --zookeeper localhost:2181 --topic testTopic --from-beginning

我可以按预期在生产者中输入消息,并在消费者中看到它们. 但是,当我使用引导服务器运行使用者的更新版本时,我什么也没得到.例如

And I can enter messages in the producer and see them in the consumer, as expected. However, when I run the updated version of the consumer using bootstrap-server, I get nothing. E.g

kafka-console-consumer --bootstrap-server localhost:9092,localhost:9093,localhost:9094 --topic testTopic --from-beginning

当我有一个代理在端口9092上运行时,此方法很好用,所以我感到非常困惑.有什么方法可以查看zookeeper提供的引导服务器吗?引导服务器与代理列表不同吗? Kafka使用Scala 2.11编译.

This worked fine when I had one broker running on port 9092 so I'm thoroughly confused. Is there a way I can see what zookeeper is providing as the bootstrap server? Is the bootstrap server different from the broker list? Kafka compiled with Scala 2.11.

推荐答案

我不知道出了什么问题.我可能将Kafka或Zookeeper置于一种奇怪的状态.在删除每个代理的log.dir中的主题以及/brokers/topics中的zookeeper主题之后,重新创建该主题之后,Kafka消费者的行为就与预期的一样.

I have no idea what was wrong. Likely I put Kafka or Zookeeper in a weird state. After deleting the topics in the log.dir of each broker AND the zookeeper topics in /brokers/topics then recreating the topic, Kafka consumer behaved as expected.

这篇关于Kafka控制台消费者中的Kafka引导服务器与Zookeeper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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