docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs -p 4001:4001 -p 2380:2380 -p 2379:2379 \
--name etcd_0 docker.io/elcolio/etcd \
-name etcd0 \
-advertise-client-urls http://172.18.0.2:2379,http://172.18.0.2:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.18.0.2:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://172.18.0.2:2380 \
-initial-cluster-state new
docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs \
--name etcd_1 docker.io/elcolio/etcd \
-name etcd0 \
-advertise-client-urls http://172.18.0.3:2379,http://172.18.0.3:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.18.0.3:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-2 \
-initial-cluster etcd0=http://172.18.0.3:2380 \
-initial-cluster-state new
docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs \
--name etcd_2 docker.io/elcolio/etcd \
-name etcd0 \
-advertise-client-urls http://172.18.0.4:2379,http://172.18.0.4:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.18.0.4:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-3 \
-initial-cluster etcd0=http://172.18.0.4:2380 \
-initial-cluster-state new
check version
curl -L http://172.18.0.2:2379/version
put key
curl http://172.18.0.2:2379/v2/keys/message -XPUT -d value="Hello world"
curl http://172.18.0.2:2379/v2/keys/message -XPUT -d value="crabxmz"
wait change
curl 'http://172.18.0.2:2379/v2/keys/foo?wait=true'
curl 'http://172.18.0.2:2379/v2/keys/foo?wait=true&waitIndex=7'
query all keys
curl -s http://172.18.0.2:2379/v2/keys -XGET|jq
query one keys
curl -s http://172.18.0.2:2379/v2/keys/foo|jq
post one keys
curl -s http://172.18.0.2:2379/v2/keys/queue -XPOST -d value=Job1|jq
curl -s http://172.18.0.2:2379/v2/keys/queue -XPOST -d value=Job2|jq
curl -s http://172.18.0.2:2379/v2/keys/queue -XGET -d value=Job2|jq
curl -s http://172.18.0.2:2379/v2/keys/tmp -XPUT -d ttl=30 -d dir=true|jq
curl -s http://172.18.0.2:2379/v2/keys/tmp -XGET|jq
curl -s http://172.18.0.2:2379/v2/keys/tmp -XPUT -d ttl=30 -d dir=true -d prevExist=true;curl -s http://172.18.0.2:2379/v2/keys/tmp -XGET|jq
condition
curl -s 'http://172.18.0.2:2379/v2/keys/queue?recursive=true' -XDELETE|jq;
read from file
curl -s http://172.18.0.2:2379/v2/keys/afile -XPUT --data-urlencode value@tmp.txt
stats
curl -s http://172.18.0.2:2379/v2/stats/leader|jq
curl -s http://172.18.0.2:2379/v2/stats/self|jq
curl -s http://172.18.0.2:2379/v2/stats/store|jq
member
curl -s http://127.0.0.1:2379/v2/members|jq
curl -s http://172.18.0.5:2379/v2/members -XPOST \
-H "Content-Type: application/json" -d '{"peerURLs":["http://172.18.0.5:2380"]}'
curl http://172.18.0.5:2379/v2/members/5f6c60d18cd68ccc -XDELETE
--name etcd_0 docker.io/elcolio/etcd \
-name etcd0 \
-advertise-client-urls http://172.18.0.2:2379,http://172.18.0.2:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.18.0.2:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://172.18.0.2:2380 \
-initial-cluster-state new
docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs \
--name etcd_1 docker.io/elcolio/etcd \
-name etcd0 \
-advertise-client-urls http://172.18.0.3:2379,http://172.18.0.3:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.18.0.3:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-2 \
-initial-cluster etcd0=http://172.18.0.3:2380 \
-initial-cluster-state new
docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs \
--name etcd_2 docker.io/elcolio/etcd \
-name etcd0 \
-advertise-client-urls http://172.18.0.4:2379,http://172.18.0.4:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.18.0.4:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-3 \
-initial-cluster etcd0=http://172.18.0.4:2380 \
-initial-cluster-state new
check version
curl -L http://172.18.0.2:2379/version
put key
curl http://172.18.0.2:2379/v2/keys/message -XPUT -d value="Hello world"
curl http://172.18.0.2:2379/v2/keys/message -XPUT -d value="crabxmz"
wait change
curl 'http://172.18.0.2:2379/v2/keys/foo?wait=true'
curl 'http://172.18.0.2:2379/v2/keys/foo?wait=true&waitIndex=7'
query all keys
curl -s http://172.18.0.2:2379/v2/keys -XGET|jq
query one keys
curl -s http://172.18.0.2:2379/v2/keys/foo|jq
post one keys
curl -s http://172.18.0.2:2379/v2/keys/queue -XPOST -d value=Job1|jq
curl -s http://172.18.0.2:2379/v2/keys/queue -XPOST -d value=Job2|jq
curl -s http://172.18.0.2:2379/v2/keys/queue -XGET -d value=Job2|jq
curl -s http://172.18.0.2:2379/v2/keys/tmp -XPUT -d ttl=30 -d dir=true|jq
curl -s http://172.18.0.2:2379/v2/keys/tmp -XGET|jq
curl -s http://172.18.0.2:2379/v2/keys/tmp -XPUT -d ttl=30 -d dir=true -d prevExist=true;curl -s http://172.18.0.2:2379/v2/keys/tmp -XGET|jq
condition
curl -s 'http://172.18.0.2:2379/v2/keys/queue?recursive=true' -XDELETE|jq;
read from file
curl -s http://172.18.0.2:2379/v2/keys/afile -XPUT --data-urlencode value@tmp.txt
stats
curl -s http://172.18.0.2:2379/v2/stats/leader|jq
curl -s http://172.18.0.2:2379/v2/stats/self|jq
curl -s http://172.18.0.2:2379/v2/stats/store|jq
member
curl -s http://127.0.0.1:2379/v2/members|jq
curl -s http://172.18.0.5:2379/v2/members -XPOST \
-H "Content-Type: application/json" -d '{"peerURLs":["http://172.18.0.5:2380"]}'
curl http://172.18.0.5:2379/v2/members/5f6c60d18cd68ccc -XDELETE