stark0323
stark0323

Reputation: 81

Kafka-node only works on Zookeeper port (2181)

When I try to make a new KafkaClient I must specify the IP of my node and the port 2181 on Node.js.

I am making heavy inserts into my DB through Kafka and everytime I leave it run overnight I get CONNECTION_LOSS[-4] errors which must have to do with Zookeeper.

On other languages the Kafka port 9092 works for producing/consuming, just not on Node.js.

How can I fix this issue and avoid these connection errors, and use port 9092 rather than 2181?

Upvotes: 0

Views: 711

Answers (1)

ppatierno
ppatierno

Reputation: 10065

What version of Kafka are you using ?

Prior to 0.9.0 the connection to Zookeeper from a consumer was needed because the consumer used Zookeeper for saving offsets.

Starting from 0.9.0, the offsets are saved in a specific topic named __consumer_offsets and for this reason the only connection the client needs is to Kafka brokers (the bootstrap ones) on the port 9092 you are talking about.

In any case remember that Kafka needs connection on Zookeeper on port 2181 for doing all the other stuff (controller election, topic information and so on).

It's not about using port 9092 instead of 2181.

Upvotes: 2

Related Questions