Skip to content

Advertised Address

A Kafka client connects in "two hops": first to any broker in bootstrap.servers to fetch metadata, then directly to the target broker (partition leader / coordinator) using the address the metadata provides. So the address a broker tells the client must be actually reachable from that client — this is what the "advertised address" solves.

Advertised address mechanism

Bind address vs advertised address

ConceptMeaning
Bind addressWhat the socket actually listens on. Often 0.0.0.0:9092 in containers.
Advertised addressThe host:port told to clients via Metadata / FindCoordinator.

The two may differ. Clients never use the bind address — only the advertised one.

How RobustMQ registers and advertises

This is a shared mechanism across protocols: at startup a node writes each protocol's external address into the meta layer's node registry (NodeExtend). Kafka's entry is kafka.tcp_addr (MQTT and NATS each have their own fields, going through the same registration / consumption path).

  • Advertised address = broker_ip + kafka_runtime.tcp_port.
  • When broker_ip is unset, the auto-detected local IP is used.
  • Both Metadata (broker list, partition leaders) and FindCoordinator (coordinator) read kafka.tcp_addr from the registry to tell clients which node to connect to directly.

Per-environment guidance

ScenarioRecommendation
Local / devThe default broker_ip = "127.0.0.1" is fine.
Multi-host cluster in one subnetSet broker_ip to the node's cluster-reachable IP.
DockerIf clients are on the host, set broker_ip to a host-reachable address, not the container's internal IP.
KubernetesSet it to an address reachable by clients for that Service / Pod; each broker needs its own stable, routable address.
NAT / publicSet it to the public address reachable from the client side.

Common failure

If the advertised address is set to something unreachable from the client (e.g. a container-internal IP, or 127.0.0.1 connected from a remote host), the symptom is usually: bootstrap connects and metadata is fetched, but the subsequent direct connect to the partition leader / coordinator times out or is refused. When debugging, first verify the host:port returned by Metadata is ping/telnet-reachable from the client.

🎉 既然都登录了 GitHub,不如顺手给我们点个 Star 吧!⭐ 你的支持是我们最大的动力 🚀