[컴] kafka-ui, kafka topic 보는 client

 

kafka client / gui / 보는 법 / 메시지 확인 방법 / 어떻게 확인 / 내용

kafka-ui, kafka topic 보는 client

compose.yml :

아래는 만약 이미 docker 로 kafka 를 실행하고 있는 경우, 그 network 에 붙어서 ui 를 사용하려 할 때 사용할 수 있다.

version: '3'

networks:
  # kafka 가 돌고 있는 network 를 찾아서 적으면 된다. docker network ls 를 이용하자.
  myexnetwork_app-tier:
    external: true

# https://github.com/provectus/kafka-ui/blob/master/docker-compose.md
# env variables: https://github.com/provectus/kafka-ui#env_variables
services:
  kafka-ui:
    image: provectuslabs/kafka-ui
    container_name: kafka-ui
    ports:
      - "8980:8080"
    # restart: always
    environment:
      - KAFKA_CLUSTERS_0_NAME=local
      - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka0:9092
      - KAFKA_CLUSTERS_0_READONLY=true
    networks:
      - myexnetwork_app-tier

docker network ls :

d:\a\prog\docker\kafka-ui>docker network ls
NETWORK ID     NAME                  DRIVER    SCOPE
8b79b620bc24   myexnetwork_app-tier  bridge    local
a48e9fa36a77   myexnetwork_default   bridge    local
9fa07d5fc255   blastradius_default   bridge    local
2c6e85339fa8   bridge                bridge    local
05cc789c7158   host                  host      local
202083e7995d   kafka-ui_app-tier     bridge    local
9c0654dab8ef   kafka-ui_default      bridge    local
a2d8a8f8fe89   none                  null      local
2ea1d4968012   testnet_mybridge      bridge    local

kafka docker compose

다음과 같은 compose.yml 을 실행하는 경우, 위의 kafka ui 를 사용하려 한다면, KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS 를 지정해 줘야 한다. 위의 kafka-ui의 compose.yml 이 그것을 위한 것이다. networks.<name>.external = true 가 핵심이라고 할 수 있겠다.

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

See Also

  1. 쿠…sal: [컴] docker compose 에서 container_name 과 hostname 의 차이

Reference

  1. GitHub - lensesio/kafka-topics-ui: Web Tool for Kafka Topics |

댓글 없음:

댓글 쓰기