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.
localhostmeans the client expects the broker on the same machine, and9092is 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
- Broker not running: nothing is listening on
localhost:9092. - Network issues: the client cannot reach the broker.
- Misconfiguration: wrong IP addresses or ports in the broker's server properties or in the client configuration.
- Firewall or security settings: port
9092is blocked.
Troubleshooting steps
- Broker status: confirm the broker is running, for example with
jpsto list Java processes or by checking the Kafka service status. - Configuration: review the broker's
server.propertiesand the client configuration for incorrect settings. - Network: use
pingandtelnetto check that port9092onlocalhostis reachable. - Logs: read both client and broker logs for further errors.
| Issue Component | Potential Cause | Resolution Step |
| Broker Availability | Broker not running | Check and start Kafka broker |
| Configuration | Misconfiguration in files | Validate entries in server.properties |
| Network | Network issues | Use ping or telnet to test connectivity |
| Firewall/Security | Ports blocked | Check 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.
Related reading
- BoringSSL-GRPC unsupported option '-G' for target 'arm64-apple-ios15.0
- boto3 client NoRegionError You must specify a region error only sometimes
- Boto 3 DynamoDB batchWriteItem Invalid attribute value type when specifying types
- botocore.exceptions.ClientError An error occurred 404 when calling the HeadObject operation Not Found
- Break when exception is thrown
- Breakpoint at throw new SilentExitException in Eclipse Spring Boot
- Breakpoints are crossed out, how can I make them valid?
- Brew install docker does not include docker engine?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo 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 courseInterview Questions practice on Codemia
Over 11,000 interview practice questions for 300+ companies, searchable by company and role.