Facing Connection Issues within Docker Compose Environment

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

The error says it’s using SASL PLAINTEXT listener, so any SSL related function usage wouldn’t be correct.

You’ll need to share your code and configs for further assistance please.

Keep in mind, this section of the forum is for Kafka Connect, a Java framework, not general network connection debugging.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.