question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help: NoBrokersAvailable

See original GitHub issue

hi in kafka_2.11-0.10.1.0 version use kafka-python to connect error

use bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning is correct my python code: from kafka import KafkaConsumer consumer = KafkaConsumer('test',bootstrap_servers=['localhost:9092']) for message in consumer: print ("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition, message.offset, message.key, message.value)) error message: Traceback (most recent call last): File “pkafka.py”, line 5, in <module> bootstrap_servers=[‘localhost:9092’]) File “/usr/lib/python2.7/site-packages/kafka_python-1.3.2.dev0-py2.7.egg/kafka/consumer/group.py”, line 287, in init self._client = KafkaClient(metrics=self._metrics, **self.config) File “/usr/lib/python2.7/site-packages/kafka_python-1.3.2.dev0-py2.7.egg/kafka/client_async.py”, line 204, in init self.config[‘api_version’] = self.check_version(timeout=check_timeout) File “/usr/lib/python2.7/site-packages/kafka_python-1.3.2.dev0-py2.7.egg/kafka/client_async.py”, line 813, in check_version raise Errors.NoBrokersAvailable() kafka.errors.NoBrokersAvailable: NoBrokersAvailable

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:26 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
typehorrorcommented, Mar 8, 2017

In case someone faces the exact same issue as I did, I believe my kafka config was the issue. I’ve added an explicit listener line to my config config/server.properties and it resolved the issue.

############################# Socket Server Settings #############################

# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
#   FORMAT:
#     listeners = listener_name://host_name:port
#   EXAMPLE:
#     listeners = PLAINTEXT://your.host.name:9092
listeners=PLAINTEXT://localhost:9092
7reactions
dpkpcommented, Mar 8, 2017

Hi all – NoBrokersAvailable is raised in this scenario if bootstrapping metadata failed. Bootstrapping relies exclusively on bootstrap_servers . If you are seeing this error it is because kafka-python was unable to connect to any of the brokers you configured as bootstrap_servers.

If you want to find out more about what is happening under the covers, enable debug logging:

import logging
logging.basicConfig(level=logging.DEBUG)

In addition there will be some additional connection logging in the next release and that should make it even easier to diagnose networking problems like this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
NoBrokersAvailable-Kafka Error - python - Stack Overflow
My kafka is running but when i want to create a partition. from kafka import TopicPartition (ERROR THERE) consumer = KafkaConsumer( ...
Read more >
Why Can't I Connect to Kafka? | Troubleshoot Connectivity
When a client wants to send or receive a message from Apache Kafka ®, there are two types of connection that must succeed:...
Read more >
nobrokersavailable - You.com | The AI Search Engine You ...
You.com is an ad-free, private search engine that you control. Customize search results with 150 apps alongside web results. Access a zero-trace private ......
Read more >
kafka.client_async — kafka-python 2.0.2-dev documentation
_conns = Dict() # object to support weakrefs self. ... Raises: NodeNotReadyError (if node_id is provided) NoBrokersAvailable (if node_id is None) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found