Hello Kafka community,
I’m relatively new to Kafka and currently trying to set up a Kafka consumer within a Docker Compose environment. Unfortunately, I’ve hit a roadblock with connection issues and I’d greatly appreciate your expertise in helping me troubleshoot this problem.
Issue: I’m encountering a “Connection refused” error when attempting to establish a connection between a Kafka consumer and a Kafka broker within Docker containers. The error message, which includes details of the failed connection attempt, is as follows:
notification-service-notification-service-1 | %3|1693292196.192|FAIL|rdkafka#consumer-1| [thrd:sasl_plaintext://kafka:9092/bootstrap]: sasl_plaintext://kafka:9092/bootstrap: Connect to ipv4#172.28.0.4:9092 failed: Connection refused (after 8ms in state CONNECT)
Setup:
- I’m using Docker Compose to manage my services, including Kafka and ZooKeeper.
- The Kafka consumer is implemented using the
confluent-kafka-python
library to consume messages from a Kafka topic. - My Kafka broker and ZooKeeper are configured using environment variables.
Aditional Info
Issue occurred after switching and recreating from aiokafka that was using create_ssl_context