This story is about the issue faced while developing when you want to connect your colleague Kafka server.

Issue

While trying to connect the Kafka tool will say unreachable to the Kafka server.

Steps to follow

As the Kafka config will contain the below structure.

Need to change three files.

  • consumer.properties
  • producer.properties
  • server.properties

consumer.properties

Original entry

bootstrap.servers=localhost:9092

# list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 …
bootstrap.servers=yourIp:9092

producer.properties

Original entry

bootstrap.servers=localhost:9092

# list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 …
bootstrap.servers=yourIp:9092

server.properties

Enable the advertised.listeners property

# Hostname and port the broker will advertise to producers and consumers. If not set,
# it uses the value for “listeners” if configured. Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName().
advertised.listeners=PLAINTEXT://yourip:9092

Happy coding.

If not working please comment.

Java 8 | Spring | React | Angular | CI/CD | Microservices | Monitoring |Apache Kafka. https://www.linkedin.com/in/shuaib-kunhabdulla-83780188