Mohammad Dayyan
Mohammad Dayyan

Reputation: 22458

Can not connect to kafka with conduktor?

I installed Kafka on a VM Ubuntu 18.0.4 with following compose file

version: '2'

networks:
  kafka-net:
    driver: bridge

services:
  zookeeper-server:
    image: 'bitnami/zookeeper:latest'
    networks:
      - kafka-net
    ports:
      - '2181:2181'
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
  kafka-server1:
    image: 'bitnami/kafka:latest'
    networks:
      - kafka-net    
    ports:
      - '9092:9092'
    environment:
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper-server:2181
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092
      - ALLOW_PLAINTEXT_LISTENER=yes
    depends_on:
      - zookeeper-server
  kafka-server2:
    image: 'bitnami/kafka:latest'
    networks:
      - kafka-net    
    ports:
      - '9093:9092'
    environment:
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper-server:2181
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9093
      - ALLOW_PLAINTEXT_LISTENER=yes
    depends_on:
      - zookeeper-server

It installed without any problem.

sudo docker container ls

CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                                                  NAMES
39f38caf57cb        bitnami/kafka:latest       "/entrypoint.sh /run…"   3 hours ago         Up 5 minutes        0.0.0.0:9092->9092/tcp                                 kafka_kafka-server1_1
088a703b5b76        bitnami/kafka:latest       "/entrypoint.sh /run…"   3 hours ago         Up 3 hours          0.0.0.0:9093->9092/tcp                                 kafka_kafka-server2_1
6a754bda47ea        bitnami/zookeeper:latest   "/entrypoint.sh /run…"   3 hours ago         Up 3 hours          2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp, 8080/tcp   kafka_zookeeper-server_1

Now, I want to connect to my Kafka on my VM with the following setting:

kafka conductor

I test it from localhost with the following

root@ubuntu:~# kafkacat -b 192.168.179.133:9092 -L
Metadata for all topics (from broker -1: 192.168.179.133:9092/bootstrap):
 1 brokers:
  broker 1001 at localhost:9092
 0 topics:

But in my windows 10 I can not connect to 192.168.179.133:9092 with Conduktor

As you see it returns error.
Test ZK is OK but Test kafka Connectivity raise the error !

Upvotes: 0

Views: 3999

Answers (1)

H.Ç.T
H.Ç.T

Reputation: 3579

You should change KAFKA_CFG_ADVERTISED_LISTENERS if your conductor is not installed in the same machine as Kafka cluster installed.

It should be like this for kafka-server1:

KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://192.168.179.33:9092

and kafka-server2:

KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://192.168.179.33:9093

Note: You should consider to add both kafka servers in conductor for redundancy.

You can check this for more information.

Upvotes: 2

Related Questions