主要功能
更多功能可以移步官网查看
https://github.com/obsidiandynamics/kafdrop
编写docker-compose-kafdrop.yaml文件
[root@kafdrop]# mkdir -p /home/kafdrop
[root@kafdrop]# vim /home/kafdrop/docker-compose.yaml
version: "2"
services:
kafdrop:
image: obsidiandynamics/kafdrop
restart: "no"
ports:
- "9000:9000"
environment:
KAFKA_BROKERCONNECT: "kafka:29092"
JVM_OPTS: "-Xms16M -Xmx48M -Xss180K -XX:-TieredCompilation -XX:+UseStringDeduplication -noverify"
depends_on:
- "kafka"
kafka:
image: obsidiandynamics/kafka
restart: "no"
ports:
- "2181:2181"
- "9092:9092"
environment:
KAFKA_LISTENERS: "INTERNAL://:29092,EXTERNAL://:9092"
KAFKA_ADVERTISED_LISTENERS: "INTERNAL://kafka:29092,EXTERNAL://localhost:9092"
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT"
KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL"
KAFKA_ZOOKEEPER_SESSION_TIMEOUT: "6000"
KAFKA_RESTART_ATTEMPTS: "10"
KAFKA_RESTART_DELAY: "5"
ZOOKEEPER_AUTOPURGE_PURGE_INTERVAL: "0"
[root@kafdrop]# docker-compose -f docker-compose-kafdrop.yaml up -d
第一次运行docker-compose
会先下载obsidiandynamics/kafka
和obsidiandynamics/kafdrop
镜像,随后启动容器。
查看容器运行状态
[root@kafdrop]# docker ps -a
java --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -jar kafdrop-4.0.1.jar --kafka.brokerConnect=127.0.0.1:9092
启动脚本 startup.sh
java --add-opens=java.base/sun.nio.ch=ALL-UNNAMED -jar kafdrop-4.0.1.jar --kafka.brokerConnect=127.0.0.1:9092
restart.sh
ps -ef | grep kafdrop-4.0.1.jar | grep -v grep | awk '{print $2}' | xargs kill -9