Skip to content

Cannot consume or produce data to topic on docker version 1.13.1 in kafka cluster with external apis #434

@hemanshupaliwa7

Description

@hemanshupaliwa7

Clarification

This issues is regarding a configuration that is working with docker swarm and docker 18.x.x but does not work with docker 1.13.1


I am able to successfully produce and consume the data inside each kafka container running on each node. However, when it try to produce or consume data externally through APIs. I am not able to do so.

I have created kafka cluster with docker stack deploy using following configuration in yml file

version: "3.1"
services:
  kafka:
    image: local-registry:5000/kafka
    deploy:
        replicas: 2
    ports:
     - "9094:9094"
    networks:
     - zoonet
    environment:
      HOSTNAME_COMMAND: "docker info | grep ^Name: | cut -d' ' -f 2" 
      KAFKA_ZOOKEEPER_CONNECT: zk1:2181,zk2:2181,zk3:2181
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: INSIDE://:9092,OUTSIDE://_{HOSTNAME_COMMAND}:9094
      KAFKA_LISTENERS: INSIDE://:9092,OUTSIDE://:9094
      KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
      BROKER_ID_COMMAND: "docker info | grep ^Name: | cut -d' ' -f 2"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
networks:
  zoonet:
    driver: overlay

Another strange behavior is that when I create a topic inside a kafka container with replication factor 1, it gets created with some random replication factor.

bash-4.4# ./kafka-topics.sh --create --zookeeper zk1:2181, zk2:2181, zk3:2181 --replication-factor 1 --partitions 1 --topic test1
Created topic "test1".
bash-4.4# ./kafka-topics.sh --describe --zookeeper zk1:2181, zk2:2181, zk3:2181 --topic test1
Topic:test1     PartitionCount:1        ReplicationFactor:1     Configs:
        Topic: test1    Partition: 0    Leader: 3       Replicas: 3     Isr: 3

I built the same set up on docker version 18x and everything works fine. I can produce and consume data with external apis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions