Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect to a kafka container #11

Open
Hienphamthe opened this issue Nov 14, 2018 · 2 comments
Open

Connect to a kafka container #11

Hienphamthe opened this issue Nov 14, 2018 · 2 comments

Comments

@Hienphamthe
Copy link

Hienphamthe commented Nov 14, 2018

Hi guys, I followed the instruction to test kadmin with localhost, its ok. But when I tried to connect kadmin (both from executable file and docker containter) with my kafka/zookeeper container, kadmin could not establish the connection. My kafka/zookeeper container could be connected with other consumers, producers container. All of them including kadmin container are in the same network.
I set the config of kadmin in docker-compose is:
ZOOKEEPER_HOST: <zookeeper container IP>:<zookeeper container port>
KAFKA_HOST: <kafka container IP>:<kafka container port>
Could any point me out? thanks all.

@OneCricketeer
Copy link

You shouldn't use container IP's. You'd use service names

@juanmcarballo
Copy link

juanmcarballo commented Jun 28, 2020

Should use a docker-compose file like this.

docker-compose.yml

version: '2'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:latest
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000

  kafka:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper
    ports:
      - 9092:9092
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
  kadmin:
    hostname: kadmin
    image: bettercloud/kadmin
    depends_on:
      - zookeeper
      - kafka
    ports:
      - "8080:8080"
    environment:
      ZOOKEEPER_HOST: zookeeper:2181
      KAFKA_HOST: kafka:29092

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants