我在 ec2 上的一台机器上设置了一个 kafka zookeeper 和 3 个代理,端口为 9092..9094,我正在尝试使用另一台机器上的主题内容。端口 2181 (zk)、9092、9093 和 9094(服务器)对消费者机器开放。我什至可以做一个 bin/kafka-topics.sh --describe --zookeeper 172.X.X.X:2181 --topic remotetopic
这给了我
Topic:remotetopic PartitionCount:1 ReplicationFactor:3 Configs: Topic: remotetopic Partition: 0 Leader: 2 Replicas: 2,0,1 Isr: 2,0,1 Blockquote
但是,当我这样做时
bin/kafka-console-consumer.sh --zookeeper 172.X.X.X:2181 --from-beginning --topic remotetopic
我得到WARN Fetching topic metadata with correlation id 0 for topics [Set(remotetopic)] from broker [id:0,host:localhost,port:9092] failed (kafka.client.ClientUtils$) java.nio.channels.ClosedChannelException
为什么消费者试图从本地主机读取?是否有任何选项或命令行或默认文件从中读取;我可以改变它吗?
任何帮助,将不胜感激!
最佳答案
我有同样的问题,我正在使用 卡夫卡 0.11 我在我的 Ubuntu VM 中启动了生产者和代理,在 Windows 10 中启动了消费者。
我已经改变了(并且没有注释)
advertised.listeners=PLAINTEXT://your.host.name:9092
到
advertised.listeners=PLAINTEXT://<myActual IP address>:9092
例子:
advertised.listeners=PLAINTEXT://192.168.150.150:9092
来自文件 config/server.properties 在服务器/代理端(即在我的情况下它是 Ubuntu VM)
关于amazon-ec2 - 卡夫卡 : How to connect kafka-console-consumer to fetch remote broker topic content?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33584124/