반응형
Recent Posts
Recent Comments
관리 메뉴

개발잡부

[kafka] docker dompose multi broker kafka 3.6 본문

Kafka

[kafka] docker dompose multi broker kafka 3.6

닉의네임 2022. 8. 27. 16:35
반응형

이거 버려..

 

cd /Users/doo/docker/kafka

(base) ➜  kafka docker compose -f docker-compose.yml up -d --build

 

docker-compose exec kafka1 kafka-topics --create --topic 900gle --bootstrap-server kafka1:9092 --replication-factor 3 --partitions 2

 

Error response from daemon: Container 2c8318196be216b730907022eccaffc314fdd7e5d8e0286ea3f6b1d219acd5c0 is restarting, wait until the container is running

 

 

 

version: '3.6'

services:
  zookeeper1:
    container_name: zookeeper1
    image: wurstmeister/zookeeper:3.4.6
    volumes:
      - "./zookeeper/data:/data"
      - "./zookeeper/logs:/datalog"
    ports:
      - "12181:2181"
  zookeeper2:
    container_name: zookeeper2
    image: wurstmeister/zookeeper:3.4.6
    volumes:
      - "./zookeeper/data:/data"
      - "./zookeeper/logs:/datalog"
    ports:
      - "22181:2181"
  zookeeper3:
    container_name: zookeeper3
    image: wurstmeister/zookeeper:3.4.6
    volumes:
      - "./zookeeper/data:/data"
      - "./zookeeper/logs:/datalog"
    ports:
      - "32181:2181"
  kafka1:
    container_name: kafka1
    image: wurstmeister/kafka:2.12-2.3.0
    restart: on-failure
    ports:
      - "9095:9092"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
      JMX_PORT: 9093
      KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=${EXPOSED_HOSTNAME} -Dcom.sun.management.jmxremote.rmi.port=9093
      KAFKA_ADVERTISED_HOST_NAME: ${EXPOSED_HOSTNAME}1
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${EXPOSED_HOSTNAME}1:9095
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
    depends_on:
      - zookeeper1
      - zookeeper2
      - zookeeper3
  kafka2:
    container_name: kafka2
    image: wurstmeister/kafka:2.12-2.3.0
    restart: on-failure
    ports:
      - "9096:9092"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      KAFKA_BROKER_ID: 2
      KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
      JMX_PORT: 9093
      KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=${EXPOSED_HOSTNAME} -Dcom.sun.management.jmxremote.rmi.port=9093
      KAFKA_ADVERTISED_HOST_NAME: ${EXPOSED_HOSTNAME}2
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${EXPOSED_HOSTNAME}2:9096
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
    depends_on:
      - zookeeper1
      - zookeeper2
      - zookeeper3
  kafka3:
    container_name: kafka3
    image: wurstmeister/kafka:2.12-2.3.0
    restart: on-failure
    ports:
      - "9097:9092"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      KAFKA_BROKER_ID: 3
      KAFKA_ZOOKEEPER_CONNECT: zookeeper1:2181,zookeeper2:2181,zookeeper3:2181
      JMX_PORT: 9093
      KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=${EXPOSED_HOSTNAME} -Dcom.sun.management.jmxremote.rmi.port=9093
      KAFKA_ADVERTISED_HOST_NAME: ${EXPOSED_HOSTNAME}3
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${EXPOSED_HOSTNAME}3:9097
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
    depends_on:
      - zookeeper1
      - zookeeper2
      - zookeeper3

  kafka-manager:
    container_name: kafka-manager
    image: hlebalbau/kafka-manager:2.0.0.2
    restart: on-failure
    depends_on:
      - kafka1
      - kafka2
      - kafka3
      - zookeeper1
      - zookeeper2
      - zookeeper3
    environment:
      ZK_HOSTS: zookeeper1:2181
      APPLICATION_SECRET: "random-secret"
      KM_ARGS: -Djava.net.preferIPv4Stack=true
    ports:
      - "9000:9000"
반응형
Comments