Docker安装kafka(docker-compose版)
创建docker-compose.yaml文件在安装目录下新建docker-compose.yaml文件version: '2'services:zookeeper:image: wurstmeister/zookeeperports:- "2181:2181"kafka:image: wurstmeister/kafkapo...
·
创建docker-compose.yaml文件
在安装目录下新建docker-compose.yaml文件
version: '2'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: 本机ip
KAFKA_CREATE_TOPICS: "test:1:1"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock
执行启动命令
1、命令行启动
docker-compose up
2、后台启动
docker-compose up -d
参考地址:https://hub.docker.com 搜索kafka
更多推荐
已为社区贡献1条内容
所有评论(0)