kafka.errors.NoBrokersAvailable exception when running producer example on Mac
See original GitHub issueRunning single-node Kafka cluster on localhost on Mac (OS X 10.11.6) Getting error on attempt to instantiate producer
>>> from kafka import KafkaProducer
>>> producer = KafkaProducer(bootstrap_servers=['localhost:9092'])
getting error
File "<stdin>", line 1, in <module>
File "/Users/user1/anaconda/envs/myenv/lib/python2.7/site-packages/kafka/producer/kafka.py", line 347, in __init__
**self.config)
File "/Users/user1/anaconda/envs/myenv/lib/python2.7/site-packages/kafka/client_async.py", line 221, in __init__
self.config['api_version'] = self.check_version(timeout=check_timeout)
File "/Users/user1/anaconda/envs/myenv/lib/python2.7/site-packages/kafka/client_async.py", line 826, in check_version
raise Errors.NoBrokersAvailable()
kafka.errors.NoBrokersAvailable: NoBrokersAvailable
Kafka is up, and running locally and producer from confluent-kafka-python
works without issues. Any suggestions what to look for?
server.properties:
. . .
listeners=PLAINTEXT://localhost:9092
. . .
Issue Analytics
- State:
- Created 6 years ago
- Comments:31 (5 by maintainers)
Top Results From Across the Web
kafka.errors.NoBrokersAvailable exception when running ...
Running single-node Kafka cluster on localhost on Mac (OS X 10.11.6) Getting error on attempt to instantiate producer >>> from kafka import ...
Read more >kafka.errors.NoBrokersAvailable exception when running ...
Running single-node Kafka cluster on localhost on Mac (OS X 10.11.6) Getting error on attempt to instantiate producer
Read more >How to Fix Apache Kafka Error, "NoBrokersAvailable" - Pandio
In this article, we'll help you solve one of the most common errors with Apache Kafka, the "NoBrokersAvailable” error.
Read more >kafka-python: producer is not able to connect - Stack Overflow
I had the same problem, and none of the solutions above worked. Then I read the exception messages and it seems it's mandatory...
Read more >raise errors.nobrokersavailable() - You.com - You.com
Message Hub requires that clients connect using a TLS 1.2 connection. This means specifying a security_protocol parameter to KafkaProducer and also a ssl....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Version 1.3.5 of this library (which is latest on pypy) only lists certain API versions 0.8.0 to 0.10.1. So unless you explicitly specify api_version to be (0, 10, 1) the client library’s attempt to discover the version will cause a NoBrokersAvailable error.
an example from my code:
I meet this problem in
centos7
, and I fix this by using flowing codeIt seems increasing this value
api_version_auto_timeout_ms
may fix this problem.