Start docker on each node, change ZOO_MY_ID accordingly
sudo docker run --net=host -d \
--name zk \
--restart always \
-e ZOO_MY_ID=1 \
-e ZOO_SERVERS="server.1=link1:2888:3888;2181 server.2=link2:2888:3888;2181" \
zookeepernow you can access zookeeper command via web:
http://link2.const.cc:8080/commands/
On each node:
docker exec -it zk /bin/bash
zkCli.shon server link1, create a node /zk_test and set string value "my_data"
create /zk_test my_data
Created /zk_teston link2, get node value of /zk_test
get /zk_test
my_datathen clean up test code on one of nodes.
delete /zk_testnote: this example only setup 2 nodes on server, you could startup your cluster as many as you want.