Kafka Java consumer never receives any messages

不羁岁月 提交于 2019-12-03 15:52:47

Answering this myself for posterity, in case anybody else runs across a similar problem.

The issue was this: The Kafka broker and Zookeeper were on an EC2 node, and the consumer was on my laptop running locally. When connecting to Zookeeper, the client was getting handed a reference to "ip-10-0-x-x.ec2.internal", which does not resolve (by default) from outside of EC2. This became clear once I properly configured log4j on the client so I was getting all of the log messages.

The workaround was to just put an entry in my /etc/hosts file, mapping the ec2 internal hostname to the publicly routable IP address.

You can solve this problem using setting following property in server.properties file located under kafka config folder

advertised.host.name=public dns of Ec2 server

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