标签:etcd 部署
静态启动
需要三台物理机或虚拟机
$ 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服务发现
在任意设备上执行,如果不加size,则默认为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服务发现
该方式目前还没有尝试,所以不予以贴出,有兴趣可以去官网查看!
注意:其中的ip地址需要根据自己的实际情况进行修改,127.0.0.1:2379不需要修改,否则会报错:bind: address already in use
本文出自 “linux相关” 博客,请务必保留此出处http://diadia.blog.51cto.com/5440926/1766678
标签:etcd 部署
原文地址:http://diadia.blog.51cto.com/5440926/1766678