docker搭建zookeeper和kafka 集群

docker 搭建zookeeper kafka 集群记录一下 (亲测成功)

只为记录,不喜勿喷!!!!拜托了

一、拉取镜像文件

docker pull zookeeper:3.5.8
docker pull wurstmeister/kafka
docker pull sheepkiller/kafka-manager:latest

二、创建指定的网络

docker network create --subnet=172.20.0.0/24 zk-net

三、创建yml配置文件并启动来创建集群容器

************************** 一 ******************************

vim zookeeper-docker-compose.yml ####复制粘贴如下内容

启动命令:docker-compose -f zookkeeper-docker-compose.yml up -d

version: ‘3.4’

services:
zook1:
image: zookeeper:3.5.8
restart: always
hostname: zook1
container_name: zook1
ports:
- 2182:2181
volumes:
- /u01/energy_system/zookeeper/zook1/data:/data
- /u01/energy_system/zookeeper/zook1/datalog:/datalog
- /u01/energy_system/zookeeper/zook1/logs:/logs
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=0.0.0.0:2888:3888;2181 server.2=zook2:2888:3888;2181 server.3=zook3:2888:3888;2181
networks:
zk-net:
ipv4_address: 172.20.0.2

zook2:
image: zookeeper:3.5.8
restart: always
hostna

你可能感兴趣的:(kafka,docker,kafka,docker,运维)