赞
踩
docker-compose.yml如下:
- version: '2'
- services:
- zookeeper:
- container_name: zookeeper
- image: wurstmeister/zookeeper
- volumes:
- - ./zookeeper/data:/data
- ports:
- - "2181:2181"
-
- kafka:
- container_name: kafka
- image: wurstmeister/kafka
- ports:
- - "9092:9092"
- environment:
- KAFKA_ADVERTISED_HOST_NAME: localhost
- KAFKA_MESSAGE_MAX_BYTES: 2000000
- KAFKA_CREATE_TOPICS: "test:1:1"
- KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
- volumes:
- - ./kafka:/kafka
- - /var/run/docker.sock:/var/run/docker.sock
-
- kafka-manager:
- container_name: kafka-manager
- image: sheepkiller/kafka-manager
- ports:
- - 9020:9000
- environment:
- ZK_HOSTS: zookeeper:2181
参数说明:
在docker-compose.yml所在目录下执行:
- # 启动:
- $ docker-compose up -d
-
- # 删除容器:
- $ docker-compose down
-
-
- # 增加更多Broker:
- $ docker-compose scale kafka=3
-
- # 合并:
- $ docker-compose up --scale kafka=3
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。