https://www.zybuluo.com/wtf0215/note/554924
etcd学习笔记
启动etcd+skydns
1.etcd --data-dir /wtf/etcd/etcd_log1 --name wtf_etcd_test1
etcd --data-dir /wtf/etcd/etcd_log1 --name wtf_etcd_test1
etcd --data-dir /wtf/etcd/etcd_log1 --name wtf_etcd_test1 > etcd_out.file 2>&1&
skydns > skydns_out.txt 2>&1&
//advertise client URLs = http://localhost:2379,http://localhost:4001
//initial advertise peer URLs = http://localhost:2380,http://localhost:7001
//initial cluster = machine1=http://localhost:2380,machine1=http://localhost:7001
2.curl -s -XPUT http://127.0.0.1:4001/v2/keys/skydns/config -d value='{"dns_addr":"127.0.0.1:53","nameserver":"8.8.8.8:53"}'
3.skydns -machines=http://127.0.0.1:4001 -nameservers=8.8.4.4:53
三个etcd启动
etcd -peer-addr 127.0.0.1:7001 -addr 127.0.0.1:4001 -data-dir /wtf/etcd/machines/machine1 -name machine1
etcd -peer-addr 127.0.0.1:7002 -addr 127.0.0.1:4002 -peers 127.0.0.1:7001,127.0.0.1:7003 -data-dir /wtf/etcd/machines/machine2 -name machine2
etcd -peer-addr 127.0.0.1:7003 -addr 127.0.0.1:4003 -peers 127.0.0.1:7001,127.0.0.1:7002 -data-dir /wtf/etcd/machines/machine3 -name machine3
官方文档
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 \
-data-dir /wtf/etcd/machines/machine1 \
-name machine1 \
-initial-advertise-peer-urls http://127.0.0.1:2380 \
-listen-peer-urls http://127.0.0.1:2380 \
-listen-client-urls http://127.0.0.1:2379 \
-advertise-client-urls http://127.0.0.1:2379\
-initial-cluster-token etcd-cluster-1 \
-initial-cluster machine1=http://127.0.0.1:2380,machine2=http://127.0.0.1:7001 \
-initial-cluster-state new
etcd \
-data-dir /wtf/etcd/machines/machine2 \
-name machine2 \
-initial-advertise-peer-urls http://127.0.0.1:7001 \
-listen-peer-urls http://127.0.0.1:7001 \
-listen-client-urls http://127.0.0.1:4001 \
-advertise-client-urls http://127.0.0.1:4001\
-initial-cluster-token etcd-cluster-1 \
-initial-cluster machine1=http://127.0.0.1:2380,machine2=http://127.0.0.1:7001 \
-initial-cluster-state new