'Why do I get Intermittent "NoBrokersAvailable" errors, with python application (kafka-python Producer)?
I’m trying to make a connection to Kafka on AWS. Communication is done over TLS.<br> Kafka-python==2.0.2 is used, and the KafkaProducer configuration is as follows:
From Kafka import KafkaProducer
producer = KafkaProducer(
bootstrap_servers=boostrap_servers, # I have three brokers in my Kafka cluster.
security_protocol='SSL',
ssl_check_hostname=False,
ssl_cafile=ssl_cafile,
value_serializer=lambda x: json.dumps(x, ensure_ascii=False).encode("utf-8"),
)
I run into NoBrokersAvailble Error intermittently without a pattern. The connection continues to fail for a moment once NoBrokersAvailable occurs.
I already checked if there's any problem connecting with the Kafka cluster on AWS:
- did nslookup test to check if DNS is not working correctly
- tested java application-Kafka connection on the same server I run my python application. It worked fine, without any error.
- no firewall issues
So these are my questions:
- What is the default number of retries when the connection is found to fail, in Kafka-python?
- I found out that NoBrokersAvailable Error is raised while checking the version of a Kafka broker; I won't get NoBrokersAvailable Error if I specify my API version. But why is this error raised from time to time, not always? Why does my python application checking version sometimes get proper return value?
- It would be helpful to know some other parameters to set, server settings to check, or any other expected error points.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
