2

I have this question regarding configuring kafka listeners properties correctly - listeners and advertised.listeners.

In my config I am setting below props:

listeners=SASL_PLAINTEXT://:9092

advertised.listeners=SASL_PLAINTEXT://u-kafkatst-kafkadev-5.sd.xxx.com:9092

The clients connect using u-kafkatst-kafkadev-5.sd.xxx.com:9092. Do I need to have the same value in listener and advertised.listeners. Here u-kafkatst-kafkadev-5.sd.xxx.com is a dns record that points to the host where kafka broker is running.

What are the situations where I would want to keep them same and different?

Thanks!

xabhi
  • 798
  • 1
  • 13
  • 30
  • Answered here - [listeners vs advertised.listeners](https://stackoverflow.com/questions/42998859/kafka-server-configuration-listeners-vs-advertised-listeners) – arunkvelu Mar 01 '19 at 11:32

1 Answers1

3

The advertised.listeners property is important if you are doing anything other than connecting to a broker directly on the same network. If you are using Docker, Kubernetes, IaaS (AWS, GCP, etc) then you need to expose the external address for the client to know where to connect to.

This article explains it all in depth.

Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92
  • Robin, how will this work in dynamic environment - https://stackoverflow.com/questions/62808955/how-to-setup-kafka-security-and-listeners-in-dynamic-environment – samshers Jul 09 '20 at 06:44