Kafka:如何连接kafka-console-consumer以获取远程代理主题内容? [英] Kafka : How to connect kafka-console-consumer to fetch remote broker topic content?

查看:850
本文介绍了Kafka:如何连接kafka-console-consumer以获取远程代理主题内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ec2上的一台机器上安装了kafka zookeeper和3个代理,端口为9092..9094,并尝试从另一台机器上使用主题内容.端口2181(zk),9092、9093和9094(服务器)对用户计算机开放.我什至可以做一个bin/kafka-topics.sh --describe --zookeeper 172.X.X.X:2181 --topic remotetopic给我

I have setup a kafka zookeeper and 3 brokers on one machine on ec2 with ports 9092..9094 and am trying to consume the topic content from another machine. The ports 2181 (zk), 9092, 9093 and 9094 (servers) are open to the consumer machine. I can even do a bin/kafka-topics.sh --describe --zookeeper 172.X.X.X:2181 --topic remotetopic which gives me

主题:远程主题分区计数:1复制因素:3配置: 主题:remotetopic分区:0领导者:2复制副本:2,0,1 Isr:2,0,1 引用

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从代理[id:0,host: localhost ,port:9092]中获取主题[Set(remotetopic)]的相关ID为0的主题元数据失败(kafka.client.ClientUtils $) java.nio.channels.ClosedChannelException

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

为什么使用者要尝试从localhost读取?是否从中读取任何选项,命令行或默认文件;我可以更改它吗?

Why is the consumer trying to read from localhost? Is there any option or commandline or default file where this is read from; and I can change it?

任何帮助将不胜感激!

推荐答案

出现相同的问题.通过按照kafka配置(config/server.properties)中的注释指示设置属性'advertised.host.name'并重新启动kafka服务器,对其进行了修复.

Had the same problem. Fixed it by setting the property 'advertised.host.name' as instructed by the comments in the kafka configuration (config/server.properties), and restarting the kafka server.

这篇关于Kafka:如何连接kafka-console-consumer以获取远程代理主题内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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