반응형
Recent Posts
Recent Comments
관리 메뉴

개발잡부

[kafka] docker compose kafka 본문

Kafka

[kafka] docker compose kafka

닉의네임 2022. 5. 8. 19:54
반응형

 

cd ~/docker/kafka

docker compose up -d --build

 

 

kafka 설치하고 kafka manager 설치

접속 : localhost:9000

 

Configuring the Kafka Manager

To setup Kafka Manager, navigate to http://localhost:9000 and complete the following steps:

  • Select Cluster and Add Cluster
  • Enter a cluster name e.g. 900gle
  • Enter a cluster ZooKeeper Host e.g. zookeeper:2181
  • Select a Kafka version matching the kafka image e.g. 0.10.1 or the highest available.
  • Save changes

1.  Add Cluster

 

2. Cluster Name : 900gle

3. Cluster Zookeeper Hosts : zookeeper:2181

 

4. Save

 

 

 

docker-compose.yml

version: '3.6'

services:
  zookeeper:
    container_name: zookeeper
    image: wurstmeister/zookeeper:3.4.6
    volumes:
      - "./zookeeper/data:/data"
      - "./zookeeper/logs:/datalog"
    ports:
      - "2181: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: zookeeper: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}
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${EXPOSED_HOSTNAME}:9095
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
    depends_on:
      - zookeeper
  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: zookeeper: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}
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${EXPOSED_HOSTNAME}:9096
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
    depends_on:
      - zookeeper
  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: zookeeper: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}
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://${EXPOSED_HOSTNAME}:9097
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 2
    depends_on:
      - zookeeper

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