0

I m trying to understand how listener configuration work in Kafka. I installed Apache Kafka on my local machine, and I have this configuration initially and commented out advertised listeners part:

listeners = PLAINTEXT://localhost:9092

and when I run Kafka cli to list topics, It works fine. However, when I add advertised listeners something like below, the cli's to describe/list doesn't work with the localhost

listeners = PLAINTEXT://localhost:9092
advertised.listeners=PLAINTEXT://hostname.local:9092
listener.security.protocol.map=PLAINTEXT:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT

and here is how I m trying to list the topics:

 bin/kafka-topics.sh --list --bootstrap-server localhost:9092
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
crisptech
  • 25
  • 5

1 Answers1

0

listeners is the address used by the embedded server in kafka to bind to. localhost:9092 will only accept local connections. A listener of 0.0.0.0:9092 will accept all external-host connections on that port. This server is used to provide TCP protocol that provides the control plane for Kafka clients.

advertised.listeners is used by Zookeeper or Raft to return addresses of Kafka brokers to Kafka clients. When advertised.listeners is not set, the value of listeners is used here.

You should try,

bin/kafka-topics.sh --list --bootstrap-server hostname.local:9092

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Mathew
  • 456
  • 3
  • 5