I use python-kafka's SimpleConsumer to listen to a topic in kafka broker. Kafka broker is running on a machine with its hostname as BROKER_HOST. Now, SimpleConsumer requests for topic metadata from the broker BROKER_HOST for a topic TOPIC & gets a tuple
(Broker metadata, Topic metadata)
Broker metadata comes as,
{0: BrokerMetadata(nodeId=0, host='localhost', port=9092)}
and ideally, host value must be BROKER_HOST(hostname
shell cmd confirms it) but it is localhost...
``How does the broker metadata for a topic get into kafka system? And obviously, this breaks the system since my consumer tries to connect to 9092 on its localhost.
This looks like your broker advertises itself incorrectly.
There's a line in your broker's server.properties
:
#advertised.host.name=<hostname routable by clients>
You should uncomment it and set the value routable by your consumer and restart your broker.