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?
In the server.properties use these two following properties
listeners=PLAINTEXT://0.0.0.0:9092
advertised.listeners=PLAINTEXT://<your ip>:9092
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
.
Have a look in the below following links, it may be helpful for your scenario,
Kafka access inside and outside docker
Kafka Listeners - Explained
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With