docker-compose kafka安装
FCAT 2020/7/2 kafkadocker-compose
构建环境:docker、docker-compose
# 配置文件
vim /docker/docker-compose.yml
version: "3.9"
services:
zookeeper:
image: wurstmeister/zookeeper
container_name: zookeeper
restart: always
volumes:
- /etc/localtime:/etc/localtime
environment:
- TZ=Asia/Shanghai
ports:
- 2181:2181
kafka:
image: wurstmeister/kafka:2.11-0.11.0.3
container_name: kafka
ports:
- 9092:9092
environment:
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://ip:9092
- KAFKA_LISTENERS=PLAINTEXT://:9092
- TZ=Asia/Shanghai
restart: always
volumes:
- /etc/localtime:/etc/localtime
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- zookeeper
networks:
default:
external:
name: mynetwork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 运行
docker network create mynetwork
docker up -d
1
2
2