Use zk images
parent
6a740841a2
commit
c84c3b225a
|
@ -1,18 +1,23 @@
|
||||||
|
|
||||||
download:
|
download:
|
||||||
docker pull yeasy/kafka:latest
|
docker pull yeasy/zookeeper:latest
|
||||||
|
|
||||||
start:
|
start:
|
||||||
|
# for swarm service mode
|
||||||
docker stack deploy --compose-file docker-compose.yaml zk
|
docker stack deploy --compose-file docker-compose.yaml zk
|
||||||
|
#docker-compose up
|
||||||
stop:
|
stop:
|
||||||
|
# for swarm service mode
|
||||||
docker stack rm zk
|
docker stack rm zk
|
||||||
|
#docker-compose down
|
||||||
|
|
||||||
restart: stop start
|
restart: stop start
|
||||||
|
|
||||||
zookeeper:
|
zookeeper:
|
||||||
docker exec -it zookeeper1 bash
|
docker exec -it zookeeper1 bash
|
||||||
kafka:
|
|
||||||
docker exec -it kafka1 bash
|
|
||||||
|
|
||||||
cli:
|
cli:
|
||||||
docker exec -it cli bash
|
docker exec -it cli bash
|
||||||
|
|
||||||
|
test:
|
||||||
|
docker exec -it cli bash -c 'bash /opt/zookeeper/bin/zkCli.sh -server zk_zookeeper1:2181'
|
||||||
|
|
|
@ -1,56 +1,68 @@
|
||||||
# The minimal kafka service
|
# The minimal zookeeper service
|
||||||
# github.com/yeasy/docker-compose-files
|
# github.com/yeasy/docker-compose-files
|
||||||
|
|
||||||
# * zk: zk node for kafka, 0, 1, 2
|
# * zk: zk node for zookeeper, 0, 1, 2
|
||||||
# * kafka: kafka service, will default to connect to zookeeper
|
# * zookeeper: zookeeper service, will default to connect to zookeeper
|
||||||
# * cli: client to test kafka service
|
# * cli: client to test zookeeper service
|
||||||
|
|
||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
zookeeper1:
|
zookeeper1:
|
||||||
image: yeasy/kafka:latest
|
image: yeasy/zookeeper:3.5.6
|
||||||
container_name: zookeeper1
|
container_name: zookeeper1
|
||||||
hostname: zookeeper1
|
hostname: zookeeper1
|
||||||
ports:
|
ports:
|
||||||
- "2182:2181" # zk connection port
|
- "2182:2181" # zk connection port
|
||||||
environment:
|
environment:
|
||||||
- ZK_ID=1 # when bootup, will read this and update the /tmp/zookeeper/myid file
|
- ZK_ID=1 # when bootup, will read this and update the /tmp/zookeeper/myid file
|
||||||
|
- ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk
|
||||||
|
- ZK_HOST2=zk_zookeeper2
|
||||||
|
- ZK_HOST3=zk_zookeeper3
|
||||||
healthcheck:
|
healthcheck:
|
||||||
disable: true
|
disable: true
|
||||||
command: bash -c 'bash /tmp/start_zk.sh'
|
command: bash -c 'bash /tmp/start_zk.sh'
|
||||||
|
|
||||||
zookeeper2:
|
zookeeper2:
|
||||||
image: yeasy/kafka:latest
|
image: yeasy/zookeeper:3.5.6
|
||||||
container_name: zookeeper2
|
container_name: zookeeper2
|
||||||
hostname: zookeeper2
|
hostname: zookeeper2
|
||||||
ports:
|
ports:
|
||||||
- "2183:2181" # zk connection port
|
- "2183:2181" # zk connection port
|
||||||
environment:
|
environment:
|
||||||
- ZK_ID=2 # when bootup, will read this and update the /tmp/zookeeper/myid file
|
- ZK_ID=2 # when bootup, will read this and update the /tmp/zookeeper/myid file
|
||||||
|
- ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk
|
||||||
|
- ZK_HOST2=zk_zookeeper2
|
||||||
|
- ZK_HOST3=zk_zookeeper3
|
||||||
healthcheck:
|
healthcheck:
|
||||||
disable: true
|
disable: true
|
||||||
command: bash -c 'bash /tmp/start_zk.sh'
|
command: bash -c 'bash /tmp/start_zk.sh'
|
||||||
|
|
||||||
zookeeper3:
|
zookeeper3:
|
||||||
image: yeasy/kafka:latest
|
image: yeasy/zookeeper:3.5.6
|
||||||
container_name: zookeeper3
|
container_name: zookeeper3
|
||||||
hostname: zookeeper3
|
hostname: zookeeper3
|
||||||
ports:
|
ports:
|
||||||
- "2181:2181" # zk connection port
|
- "2181:2181" # zk connection port
|
||||||
environment:
|
environment:
|
||||||
- ZK_ID=3 # when bootup, will read this and update the /tmp/zookeeper/myid file
|
- ZK_ID=3 # when bootup, will read this and update the /tmp/zookeeper/myid file
|
||||||
|
- ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk
|
||||||
|
- ZK_HOST2=zk_zookeeper2
|
||||||
|
- ZK_HOST3=zk_zookeeper3
|
||||||
healthcheck:
|
healthcheck:
|
||||||
disable: true
|
disable: true
|
||||||
command: bash -c 'bash /tmp/start_zk.sh'
|
command: bash -c 'bash /tmp/start_zk.sh'
|
||||||
|
|
||||||
cli: # used for testing kafka cmds, see /tmp/*.sh
|
cli: # used for testing zookeeper cmds, see /tmp/*.sh
|
||||||
image: yeasy/kafka:latest
|
image: yeasy/zookeeper:3.5.6
|
||||||
container_name: cli
|
container_name: cli
|
||||||
hostname: cli
|
hostname: cli
|
||||||
environment:
|
environment:
|
||||||
- ZK_HOST=zookeeper1 # zk host to connect to
|
- ZK_HOST=zookeeper1 # zk host to connect to
|
||||||
# bash /opt/zookeeper/bin/zkCli.sh -server ${ZK_HOST}:2181
|
- ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk
|
||||||
|
- ZK_HOST2=zk_zookeeper2
|
||||||
|
- ZK_HOST3=zk_zookeeper3
|
||||||
healthcheck:
|
healthcheck:
|
||||||
disable: true
|
disable: true
|
||||||
|
# bash /opt/zookeeper/bin/zkCli.sh -server ${ZK_HOST}:2181
|
||||||
command: bash -c 'while true; do sleep 20200116; done'
|
command: bash -c 'while true; do sleep 20200116; done'
|
||||||
|
|
Loading…
Reference in New Issue