Volatil3
Volatil3

Reputation: 15016

PyKafka client connecting wrong broker

I am unable to figure out what's happening.

I started producer by running the command:

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

and consumer:

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

But when I do

client = KafkaClient('localhost:9092')

It always says: Failed to connect newly created broker for b'adnans-mbp':9092

Error encountered when producing to broker b'adnans-mbp':9092. Retrying.
Error encountered when producing to broker b'adnans-mbp':9092. Retrying.

On sending messages I get nothing in program. Although on console it's receiving messages.

What's wrong am I doing?

Upvotes: 1

Views: 671

Answers (1)

Emmett Butler
Emmett Butler

Reputation: 6217

Check out the listeners property in the server.properties config file. It looks like your KafkaClient instance is unable to communicate with the broker you're running locally, possibly due to the hostname translation that's turning localhost into adnans-mbp.

See also https://github.com/Parsely/pykafka/issues/812

Upvotes: 1

Related Questions