Install zookeeper cluster with docker
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" \
zookeeper
now you can access zookeeper command via web:
http://link2.const.cc:8080/commands/
On each node:
docker exec -it zk /bin/bash
zkCli.sh
on server link1, create a node /zk_test and set string value "my_data"
create /zk_test my_data
Created /zk_test
on link2, get node value of /zk_test
get /zk_test
my_data
then clean up test code on one of nodes.
delete /zk_test
note: this example only setup 2 nodes on server, you could startup your cluster as many as you want.