- How Kafka clients discover and connect to brokers
- Why advertised host configuration matters
- How to configure advertised listeners for different network topologies
- Common pitfalls and how to avoid them
Connecting to a Kafka cluster
When a client connects to a Kafka cluster, the broker responds with the advertised host that the client MUST use for all future communications - regardless of how the initial connection was made.Setting advertised host as localhost
If you set the Advertised Host as localhost, the Kafka client will successfully connect to the cluster if it is running on the same machine as the broker.Setting advertised host as public IP
If you set the Advertised Host as the broker’s Public IP, the Kafka client will successfully connect to the cluster as long as the Public IP doesn’t change. It may change if the broker re-boots. If that happens, the connection cannot be re-established.Configure advertised host
| Client location | Recommended setting |
|---|---|
| Same network as broker | Internal private IP or DNS hostname |
| Public network | External public IP or DNS hostname |
| Both internal and external | Configure multiple listeners |
Example: Internal clients only
Example: External clients only
Example: Both internal and external clients
See it in practice with ConduktorConduktor Console displays broker listener configurations and helps diagnose connectivity issues. Test connections from different network locations to verify your advertised listener settings.
Next steps
- Set up cluster architecture for production
- Configure security for your listeners
- Monitor broker health