DockerCompose部署Zookeeper+Kafka+KafkaManager
docker-compose.yml
version: '3.5'
services:
zookeeper:
image: wurstmeister/zookeeper ## 镜像
container_name: zookeeper
ports:
- "2181:2181" ## 对外暴露的端口号
kafka:
image: wurstmeister/kafka ## 镜像
container_name: kafka
volumes:
- /etc/localtime:/etc/localtime ## 挂载位置(kafka镜像和宿主机器之间时间保持一直)
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: 192.168.1.5 ## 修改:宿主机IP
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 ## 卡夫卡运行是基于zookeeper的
KAFKA_ADVERTISED_PORT: 9092
KAFKA_LOG_RETENTION_HOURS: 120
KAFKA_MESSAGE_MAX_BYTES: 10000000
KAFKA_REPLICA_FETCH_MAX_BYTES: 10000000
KAFKA_GROUP_MAX_SESSION_TIMEOUT_MS: 60000
KAFKA_NUM_PARTITIONS: 3
KAFKA_DELETE_RETENTION_MS: 1000
kafka-manager:
image: sheepkiller/kafka-manager ## 镜像:开源的web管理kafka集群的界面
container_name: kafka-manager
environment:
ZK_HOSTS: 192.168.1.5 ## 修改:宿主机IP
ports:
- "9009:9000" ## 暴露端口 9000这个端口冲突太多
注:宿主机IP根据实际填写,如果不需要外部连接,填写127.0.0.1即可,此处我是在桥接网络的Ubuntu虚拟机上部署,为了在Windows上使用Kafka所以使用虚拟机的IP地址
运行命令
sudo docker-compose up -d --build
桌面GUI工具
Offset Explorer