Error producing to a topic

Hi there

I setup kafka using docker-compose but I am getting an error when trying to write messages to a topic. I am using the python client to create topics. The topics are created successfully (though I am getting nodename nor servname provided, or not known). When I try to publish to that topic, the code hangs and produces the same error and the message is not published to kafka. Please help me solve this. Thanks.

hey @Makabongwe

welcome :slight_smile:

would you share you’re config?

best,
michael

Hey @mmuehlbeyer

Thanks for the response. I was able to fix that error by adding the last line in my docker-compose file.

version: "3"
services:
  kafka:
    image: 'bitnami/kafka:latest'
    ports:
      - '9092:9092'
    environment:
      - KAFKA_CFG_NODE_ID=0
      - KAFKA_CFG_PROCESS_ROLES=controller,broker
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
      - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
      - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093
      - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
      - KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://<IP>:9092

IP being the IP address of my host machine.

1 Like