docker zookeeper kafka kafka-man
2022-01-07 本文已影响0人
黑猫警长1122
mac下通过docker安装kafka
version: '3'
services:
zookeeper:
image: zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
depends_on: [ zookeeper ]
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: 172.16.12.119
KAFKA_CREATE_TOPICS: "test:1:1"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- ~/dockercompose/kafka/docker.sock:/var/run/docker.sock
kafka-manager:
image: sheepkiller/kafka-manager
depends_on:
- zookeeper
- kafka
ports:
- "9000:9000"
environment:
ZK_HOSTS: zookeeper:2181
将文件保存为compose.yml,从终端进入文件所在文件夹,通过docker启动
$ docker build
$ docker up -d
从docker客户端可以看到容器已经启动
image.png
访问http://127.0.0.1:9000,add cluster
image.png
image.png
安装完成。