Vahid F
Vahid F

Reputation: 458

Kafka broker is not available from localhost

I have installed kafka_2.11-1.1.0 and set advertised listener to advertised.listeners=PLAINTEXT://<my-ip>:9092 (in $KAFKA_HOME/config/server.properties).

I can connect and write to my kafka using java code and see my cluster via kafka-tool from another server but I can't write messages to my topic from my local machine (the one that I have installed kafka cluster on it).

I have also tried to set listeners value to listeners = PLAINTEXT://:9092 but there is no change. What should I do to my kafka to make it reachable and writable from both outside and inside of the localhost?

Upvotes: 6

Views: 19388

Answers (3)

Vahid F
Vahid F

Reputation: 458

I finally solved the issue by changing my code's org.apache.kafka library from version 1.1.0 to version 2.1.0.

I mention that all of these libraries were imported (downloaded) and used via mvnrepository.com.

Also, our kafka producer and consumer code pattern were written using this article: https://dzone.com/articles/kafka-producer-and-consumer-example.

Upvotes: 3

Shiva
Shiva

Reputation: 63

Have a look in the below following links, it may be helpful for your scenario,

Upvotes: 2

Bitswazsky
Bitswazsky

Reputation: 4698

In the server.properties use these two following properties

listeners=PLAINTEXT://0.0.0.0:9092 
advertised.listeners=PLAINTEXT://<your ip>:9092

Upvotes: 10

Related Questions