Ayan Bhattacharjee
Ayan Bhattacharjee

Reputation: 515

How to connect kafka producer and consumer to a machine that is running kafka and zookeeper

I have a ubuntu machine that is having kafka and zookeepr installed in it, I am using spring boot for making the consumer and producer, locally the process works, however, when the deploy the producer and consumer jar to another machine it doesn't work

Upvotes: 0

Views: 69

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191874

Kafka defaults to only listen locally.

You need to set these in Kafka's server.properties

listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://<external-ip>:9092

https://www.confluent.io/blog/kafka-listeners-explained/

Then, obviously, don't use localhost:9092 in your remote client code.

You should never need Zookeeper connection details. Besides, as of Kafka 3.3.1, Zookeeper isn't required at all.

Upvotes: 1

Related Questions