Created
May 18, 2016 11:33
-
-
Save kkc/a2c5328fe1d8d68ea0b45751b1a2e250 to your computer and use it in GitHub Desktop.
etcd cluster by using docker-machine
This file contains 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
docker-machine create -d virtualbox etcd0 | |
docker-machine create -d virtualbox etcd1 | |
docker-machine create -d virtualbox etcd2 | |
eval $(docker-machine env etcd0) | |
docker $(docker-machine config etcd0) run -d \ | |
--restart="always" \ | |
-p 4001:4001 -p 2380:2380 -p 2379:2379 \ | |
--name etcd quay.io/coreos/etcd \ | |
-name etcd0 \ | |
-advertise-client-urls http://$(docker-machine ip etcd0):2379,http://$(docker-machine ip etcd0):4001 \ | |
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ | |
-initial-advertise-peer-urls http://$(docker-machine ip etcd0):2380 \ | |
-listen-peer-urls http://0.0.0.0:2380 \ | |
-initial-cluster-token etcd-cluster-1 \ | |
-initial-cluster etcd0=http://$(docker-machine ip etcd0):2380,etcd1=http://$(docker-machine ip etcd1):2380,etcd2=http://$(docker-machine ip etcd2):2380 \ | |
-initial-cluster-state new | |
eval $(docker-machine env etcd1) | |
docker $(docker-machine config etcd1) run -d \ | |
--restart="always" \ | |
-p 4001:4001 -p 2380:2380 -p 2379:2379 \ | |
--name etcd quay.io/coreos/etcd \ | |
-name etcd1 \ | |
-advertise-client-urls http://$(docker-machine ip etcd1):2379,http://$(docker-machine ip etcd1):4001 \ | |
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ | |
-initial-advertise-peer-urls http://$(docker-machine ip etcd1):2380 \ | |
-listen-peer-urls http://0.0.0.0:2380 \ | |
-initial-cluster-token etcd-cluster-1 \ | |
-initial-cluster etcd0=http://$(docker-machine ip etcd0):2380,etcd1=http://$(docker-machine ip etcd1):2380,etcd2=http://$(docker-machine ip etcd2):2380 \ | |
-initial-cluster-state new | |
eval $(docker-machine env etcd2) | |
docker $(docker-machine config etcd2) run -d \ | |
--restart="always" \ | |
-p 4001:4001 -p 2380:2380 -p 2379:2379 \ | |
--name etcd quay.io/coreos/etcd \ | |
-name etcd2 \ | |
-advertise-client-urls http://$(docker-machine ip etcd2):2379,http://$(docker-machine ip etcd2):4001 \ | |
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ | |
-initial-advertise-peer-urls http://$(docker-machine ip etcd2):2380 \ | |
-listen-peer-urls http://0.0.0.0:2380 \ | |
-initial-cluster-token etcd-cluster-1 \ | |
-initial-cluster etcd0=http://$(docker-machine ip etcd0):2380,etcd1=http://$(docker-machine ip etcd1):2380,etcd2=http://$(docker-machine ip etcd2):2380 \ | |
-initial-cluster-state new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment