Kafka : How to connect kafka-console-consumer to fetch remote broker topic content?

匆匆过客 提交于 2019-12-04 08:27:30

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.

I had same problem , I am using kafka 0.11 and I started producer and broker in my Ubuntu VM and consumer in Windows 10.

I had changed (and uncommented)

advertised.listeners=PLAINTEXT://your.host.name:9092

to

advertised.listeners=PLAINTEXT://<myActual IP address>:9092

example:

advertised.listeners=PLAINTEXT://192.168.150.150:9092

from file config/server.properties at server/broker side (i.e. in my case it was Ubuntu VM)

I have created a python script which allows you to access kafka/zookeeper via ssh tunnel to consume and produce messages from your local machine.

Compatible for Linux & Mac

Usage: kafkatunnel.py [OPTIONS] COMMAND [ARGS]...

  Access kafka/zookeeper via ssh tunnel to consume and produce messages from
  your local machine

Commands:
  aws     retrieve kafka/zookeeper ip's from AWS...
  manual  provide the IP's of your zookeeper/kafka

try it: https://github.com/simple-machines/kafka-tunnel

I have setup Kafka and Zookeeper in a similar (and even more complex) arrangement and the kafka-console-consumer.sh does work as advertised.

This is very likely a mis-configured Kafka instance (which specifies its zookeeper nodes in the server configuration).

Check the Kafka configuration. By default if the zookeeper instances are NOT specified, it presumes a singular localhost instance. Otherwise the "server.1" ... 2 etc convention must be used to define the zookeeper instances (minimum three being recommended/required to obtain proper quorum).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!