Static start
Requires three physical machines or virtual machines
$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 --listen-peer-urls http://10.0.1.10:2380 --listen-client-urls http:// 10.0.1.10:2379,http://127.0.0.1:2379 --advertise-client-urls http://10.0.1.10:2379 --initial-cluster-token etcd-cluster-1 --initial-cluster infra0=http:// 10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 -- Initial-cluster-state new$ etcd --name infra1 --initial-advertise-peer-urls http ://10.0.1.11:2380 --listen-peer-urls http://10.0.1.11:2380 -- Listen-client-urls http://10.0.1.11:2379,http://127.0.0.1:2379 --advertise-client-urls http://10.0.1.11:2379 --initial-cluster-token etcd-cluster-1 -- Initial-cluster infra0=http://10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 --initial-cluster-state new$ etcd --name infra2 --initial-advertise-peer-urls http://10.0.1.12:2380 --listen-peer-urls http://10.0.1.12:2380 --listen-client-urls http:// 10.0.1.12:2379,http://127.0.0.1:2379 --advertise-client-urls http://10.0.1.12:2379 --initial-cluster-token etcd-cluster-1 --initial-cluster infra0=http:// 10.0.1.10:2380,infra1=http://10.0.1.11:2380,infra2=http://10.0.1.12:2380 -- Initial-cluster-state new
2. ETCD Service Discovery
Executes on any device, and if no size is added, the default is 3$ curl-w "\ n" https://discovery.etcd.io/new?size=3
$ etcd --name infra0 --initial-advertise-peer-urls http://10.0.1.10:2380 --listen-peer-urls http://10.0.1.10:2380 --listen-client-urls http:// 10.0.1.10:2379,http://127.0.0.1:2379 --advertise-client-urls http://10.0.1.10:2379 --discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de$ etcd --name infra1 --initial-advertise-peer-urls http://10.0.1.11:2380 -- listen-peer-urls http://10.0.1.11:2380 --listen-client-urls http://10.0.1.11:2379, http://127.0.0.1:2379 --advertise-client-urls http://10.0.1.11:2379 -- discovery https://discovery.etcd.io/3e86b59982e49066c5d813af1c2e2579cbf573de$ etcd --name infra2 --initial-advertise-peer-urls http://10.0.1.12:2380 --listen-peer-urls Http://10.0.1.12:2380 --listen-client-urls http://10.0.1.12:2379,http://127.0.0.1:2379 -- advertise-client-urls http://10.0.1.12:2379 --discovery https://discovery.etcd.io/ 3e86b59982e49066c5d813af1c2e2579cbf573de
3. DNS Service discovery
This method has not been tried, so do not post it, interested can go to the official website to view!
Note: The IP address needs to be modified according to its own situation, 127.0.0.1:2379 does not need to be modified, otherwise it will error: Bind:address already in use
This article is from the "Linux related" blog, so be sure to keep this source http://diadia.blog.51cto.com/5440926/1766678
ETCD three ways to deploy a cluster