initial commit

This commit is contained in:
ston1th 2021-06-14 14:56:03 +02:00
commit d4f5bfeca0
7 changed files with 1077 additions and 0 deletions

48
etcd_cluster.sh Executable file
View file

@ -0,0 +1,48 @@
#!/bin/sh
REGISTRY=gcr.io/etcd-development/etcd
NODE1=127.0.0.1
NODE2=127.0.0.1
NODE3=127.0.0.1
P11=2379;P12=2380
P21=2381;P22=2382
P31=2383;P32=2384
[ $1 == "1" ] && docker run \
--rm -t \
--network=host \
--name etcd0 ${REGISTRY}:latest \
/usr/local/bin/etcd \
-name etcd0 \
-advertise-client-urls http://${NODE1}:${P11} \
-listen-client-urls http://${NODE1}:${P11} \
-initial-advertise-peer-urls http://${NODE1}:${P12} \
-listen-peer-urls http://${NODE1}:${P12} \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://${NODE1}:${P12},etcd1=http://${NODE2}:${P22},etcd2=http://${NODE3}:${P32} \
-initial-cluster-state new
[ $1 == "2" ] && docker run \
--rm -t \
--network=host \
--name etcd1 ${REGISTRY}:latest \
/usr/local/bin/etcd \
-name etcd1 \
-advertise-client-urls http://${NODE2}:${P21} \
-listen-client-urls http://${NODE2}:${P21} \
-initial-advertise-peer-urls http://${NODE2}:${P22} \
-listen-peer-urls http://${NODE2}:${P22} \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://${NODE1}:${P12},etcd1=http://${NODE2}:${P22},etcd2=http://${NODE3}:${P32} \
-initial-cluster-state new
[ $1 == "3" ] && docker run \
--rm -t \
--network=host \
--name etcd2 ${REGISTRY}:latest \
/usr/local/bin/etcd \
-name etcd2 \
-advertise-client-urls http://${NODE3}:${P31} \
-listen-client-urls http://${NODE3}:${P31} \
-initial-advertise-peer-urls http://${NODE3}:${P32} \
-listen-peer-urls http://${NODE3}:${P32} \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://${NODE1}:${P12},etcd1=http://${NODE2}:${P22},etcd2=http://${NODE3}:${P32} \
-initial-cluster-state new