Created
August 20, 2017 04:34
-
-
Save xissy/6942fe255d689a71bf9cff001c531746 to your computer and use it in GitHub Desktop.
Bootstrap etcd v3 cluster
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For each machine | |
ETCD_VERSION=v3.2.5 | |
TOKEN=taipei101-etcd-token | |
CLUSTER_STATE=new | |
NAME_1=core-1 | |
NAME_2=core-2 | |
NAME_3=core-3 | |
HOST_1=10.0.1.1 | |
HOST_2=10.0.1.2 | |
HOST_3=10.0.1.3 | |
CLUSTER=${NAME_1}=http://${HOST_1}:2380,${NAME_2}=http://${HOST_2}:2380,${NAME_3}=http://${HOST_3}:2380 | |
DATA_DIR=/var/lib/etcd | |
# For node 1 | |
THIS_NAME=${NAME_1} | |
THIS_IP=${HOST_1} | |
docker run \ | |
-d \ | |
--restart always \ | |
--net host \ | |
-p 2379:2379 \ | |
-p 2380:2380 \ | |
--volume=${DATA_DIR}:/etcd-data \ | |
--name etcd quay.io/coreos/etcd:${ETCD_VERSION} \ | |
/usr/local/bin/etcd \ | |
--data-dir=/etcd-data --name ${THIS_NAME} \ | |
--initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://${THIS_IP}:2380 \ | |
--advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://${THIS_IP}:2379 \ | |
--initial-cluster ${CLUSTER} \ | |
--initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For each machine | |
ETCD_VERSION=v3.2.5 | |
TOKEN=taipei101-etcd-token | |
CLUSTER_STATE=new | |
NAME_1=core-1 | |
NAME_2=core-2 | |
NAME_3=core-3 | |
HOST_1=10.0.1.1 | |
HOST_2=10.0.1.2 | |
HOST_3=10.0.1.3 | |
CLUSTER=${NAME_1}=http://${HOST_1}:2380,${NAME_2}=http://${HOST_2}:2380,${NAME_3}=http://${HOST_3}:2380 | |
DATA_DIR=/var/lib/etcd | |
# For node 2 | |
THIS_NAME=${NAME_2} | |
THIS_IP=${HOST_2} | |
docker run \ | |
-d \ | |
--restart always \ | |
--net host \ | |
-p 2379:2379 \ | |
-p 2380:2380 \ | |
--volume=${DATA_DIR}:/etcd-data \ | |
--name etcd quay.io/coreos/etcd:${ETCD_VERSION} \ | |
/usr/local/bin/etcd \ | |
--data-dir=/etcd-data --name ${THIS_NAME} \ | |
--initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://${THIS_IP}:2380 \ | |
--advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://${THIS_IP}:2379 \ | |
--initial-cluster ${CLUSTER} \ | |
--initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For each machine | |
ETCD_VERSION=v3.2.5 | |
TOKEN=taipei101-etcd-token | |
CLUSTER_STATE=new | |
NAME_1=core-1 | |
NAME_2=core-2 | |
NAME_3=core-3 | |
HOST_1=10.0.1.1 | |
HOST_2=10.0.1.2 | |
HOST_3=10.0.1.3 | |
CLUSTER=${NAME_1}=http://${HOST_1}:2380,${NAME_2}=http://${HOST_2}:2380,${NAME_3}=http://${HOST_3}:2380 | |
DATA_DIR=/var/lib/etcd | |
# For node 3 | |
THIS_NAME=${NAME_3} | |
THIS_IP=${HOST_3} | |
docker run \ | |
-d \ | |
--restart always \ | |
--net host \ | |
-p 2379:2379 \ | |
-p 2380:2380 \ | |
--volume=${DATA_DIR}:/etcd-data \ | |
--name etcd quay.io/coreos/etcd:${ETCD_VERSION} \ | |
/usr/local/bin/etcd \ | |
--data-dir=/etcd-data --name ${THIS_NAME} \ | |
--initial-advertise-peer-urls http://${THIS_IP}:2380 --listen-peer-urls http://${THIS_IP}:2380 \ | |
--advertise-client-urls http://${THIS_IP}:2379 --listen-client-urls http://${THIS_IP}:2379 \ | |
--initial-cluster ${CLUSTER} \ | |
--initial-cluster-state ${CLUSTER_STATE} --initial-cluster-token ${TOKEN} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment