Bootstrap
Broker
Localhost:9092
Disconnection issues
IT troubleshooting

Kafka "Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected"

Codemia Knowledge Hub ·

The Kafka client tried to reach its bootstrap broker at localhost:9092 and the connection dropped. The usual causes are a broker that isn't running, a wrong address or port in the client or broker configuration, a network problem, or a firewall blocking port 9092.

What the bootstrap broker does

A Kafka cluster is one or more brokers, servers that store published data. Producers and consumers make their first connection through a bootstrap broker, whose main job is to give the client metadata about the other brokers and the cluster layout.

Reading the message

  • Bootstrap broker: the broker the client connects to first.
  • localhost:9092: the default address. localhost means the client expects the broker on the same machine, and 9092 is Kafka's default port.
  • id: -1: this is not the broker's real ID. Before the client has fetched cluster metadata, it labels its configured bootstrap addresses with negative placeholder IDs (-1, -2 and so on). The ID itself does not indicate a broker misconfiguration; a client that never gets past it simply never reached a broker.
  • rack: null: no rack information is set, which is common outside production.

Why the connection drops

  1. Broker not running: nothing is listening on localhost:9092.
  2. Network issues: the client cannot reach the broker.
  3. Misconfiguration: wrong IP addresses or ports in the broker's server properties or in the client configuration.
  4. Firewall or security settings: port 9092 is blocked.

Troubleshooting steps

  1. Broker status: confirm the broker is running, for example with jps to list Java processes or by checking the Kafka service status.
  2. Configuration: review the broker's server.properties and the client configuration for incorrect settings.
  3. Network: use ping and telnet to check that port 9092 on localhost is reachable.
  4. Logs: read both client and broker logs for further errors.
Issue ComponentPotential CauseResolution Step
Broker AvailabilityBroker not runningCheck and start Kafka broker
ConfigurationMisconfiguration in filesValidate entries in server.properties
NetworkNetwork issuesUse ping or telnet to test connectivity
Firewall/SecurityPorts blockedCheck and modify firewall rules

Preventing it

  • List more than one bootstrap broker in the client configuration for redundancy.
  • Keep Kafka client and broker versions compatible.
  • Newer Kafka versions may change defaults or behavior, so re-check your configuration after upgrades.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Interview Questions practice on Codemia

Over 11,000 interview practice questions for 300+ companies, searchable by company and role.

Browse interview questions