Use zk images
parent
6a740841a2
commit
c84c3b225a
|
@ -1,18 +1,23 @@
|
|||
|
||||
download:
|
||||
docker pull yeasy/kafka:latest
|
||||
docker pull yeasy/zookeeper:latest
|
||||
|
||||
start:
|
||||
# for swarm service mode
|
||||
docker stack deploy --compose-file docker-compose.yaml zk
|
||||
#docker-compose up
|
||||
stop:
|
||||
# for swarm service mode
|
||||
docker stack rm zk
|
||||
#docker-compose down
|
||||
|
||||
restart: stop start
|
||||
|
||||
zookeeper:
|
||||
docker exec -it zookeeper1 bash
|
||||
kafka:
|
||||
docker exec -it kafka1 bash
|
||||
|
||||
cli:
|
||||
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
|
||||
|
||||
# * zk: zk node for kafka, 0, 1, 2
|
||||
# * kafka: kafka service, will default to connect to zookeeper
|
||||
# * cli: client to test kafka service
|
||||
# * zk: zk node for zookeeper, 0, 1, 2
|
||||
# * zookeeper: zookeeper service, will default to connect to zookeeper
|
||||
# * cli: client to test zookeeper service
|
||||
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
zookeeper1:
|
||||
image: yeasy/kafka:latest
|
||||
image: yeasy/zookeeper:3.5.6
|
||||
container_name: zookeeper1
|
||||
hostname: zookeeper1
|
||||
ports:
|
||||
- "2182:2181" # zk connection port
|
||||
environment:
|
||||
- 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:
|
||||
disable: true
|
||||
command: bash -c 'bash /tmp/start_zk.sh'
|
||||
|
||||
zookeeper2:
|
||||
image: yeasy/kafka:latest
|
||||
image: yeasy/zookeeper:3.5.6
|
||||
container_name: zookeeper2
|
||||
hostname: zookeeper2
|
||||
ports:
|
||||
- "2183:2181" # zk connection port
|
||||
environment:
|
||||
- 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:
|
||||
disable: true
|
||||
command: bash -c 'bash /tmp/start_zk.sh'
|
||||
|
||||
zookeeper3:
|
||||
image: yeasy/kafka:latest
|
||||
image: yeasy/zookeeper:3.5.6
|
||||
container_name: zookeeper3
|
||||
hostname: zookeeper3
|
||||
ports:
|
||||
- "2181:2181" # zk connection port
|
||||
environment:
|
||||
- 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:
|
||||
disable: true
|
||||
command: bash -c 'bash /tmp/start_zk.sh'
|
||||
|
||||
cli: # used for testing kafka cmds, see /tmp/*.sh
|
||||
image: yeasy/kafka:latest
|
||||
cli: # used for testing zookeeper cmds, see /tmp/*.sh
|
||||
image: yeasy/zookeeper:3.5.6
|
||||
container_name: cli
|
||||
hostname: cli
|
||||
environment:
|
||||
- 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:
|
||||
disable: true
|
||||
# bash /opt/zookeeper/bin/zkCli.sh -server ${ZK_HOST}:2181
|
||||
command: bash -c 'while true; do sleep 20200116; done'
|
||||
|
|
Loading…
Reference in New Issue