[컴] kafka 개발용, docker

디버깅 / debug / dev / 개발 할 때 손쉽게 카프카 사용

kafka 개발용, docker

간단하게 docker compose up 으로 kafka 를 실행해서, 개발시 사용할 수 있다. kafka-ui 는 browser 에서 'http://localhost:8980' 로 접근하면 사용할 수 있다.

# compose.yml
version: '3'

# https://hub.docker.com/r/bitnami/kafka 
# --> Apache Kafka development setup example

networks:
  app-tier:
    driver: bridge

services:
  zookeeper:
    image: 'bitnami/zookeeper:latest'
    ports:
      - '2181:2181'
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
    networks:
      - app-tier
  kafka:
    # https://hub.docker.com/r/bitnami/kafka
    image: 'bitnami/kafka:latest'
    hostname: kafkah0
    container_name: kafka0
    ports:
      - '9092:9092'
    environment:
      - KAFKA_BROKER_ID=1
      - KAFKA_CFG_LISTENERS=PLAINTEXT://kafkah0:9092
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafkah0:9092
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
      - ALLOW_PLAINTEXT_LISTENER=yes
    depends_on:
      - zookeeper
    networks:
      - app-tier
  kafka-ui:
    image: provectuslabs/kafka-ui
    container_name: kafka-ui-0
    ports:
      - "8980:8080"
    # restart: always
    environment:
      - KAFKA_CLUSTERS_0_NAME=local
      - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafkah0:9092
      - KAFKA_CLUSTERS_0_READONLY=true
    depends_on:
      - kafka
    networks:
      - app-tier

댓글 없음:

댓글 쓰기