部署环境:
CentOS Linux release 7.2 64位
10.10.0.103 etcd master
10.10.0.49 etcd follower
master安装过程:
# yum update
# yum install -y etcd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# [member] ETCD_NAME=etcd1 ETCD_DATA_DIR= "/var/lib/etcd/default.etcd"
#ETCD_WAL_DIR="" #ETCD_SNAPSHOT_COUNT="10000" ETCD_HEARTBEAT_INTERVAL= "1000"
ETCD_ELECTION_TIMEOUT= "10000"
ETCD_LISTEN_PEER_URLS= "http://10.10.0.103:2380"
ETCD_LISTEN_CLIENT_URLS= "http://10.10.0.103:2379,http://127.0.0.1:2379"
#ETCD_MAX_SNAPSHOTS="5" #ETCD_MAX_WALS="5" #ETCD_CORS="" # #[cluster] ETCD_INITIAL_ADVERTISE_PEER_URLS= "http://10.10.0.103:2380"
# if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test=http://..." ETCD_INITIAL_CLUSTER= "etcd1=http://10.10.0.103:2380,etcd2=http://10.10.0.49:2380"
#ETCD_INITIAL_CLUSTER_STATE="new" ETCD_INITIAL_CLUSTER_TOKEN= "etcd-cluster"
ETCD_ADVERTISE_CLIENT_URLS= "http://10.10.0.103:2379"
#ETCD_DISCOVERY="" #ETCD_DISCOVERY_SRV="" #ETCD_DISCOVERY_FALLBACK="proxy" #ETCD_DISCOVERY_PROXY="" #ETCD_STRICT_RECONFIG_CHECK="false" #ETCD_AUTO_COMPACTION_RETENTION="0" # #[proxy] #ETCD_PROXY="off" #ETCD_PROXY_FAILURE_WAIT="5000" #ETCD_PROXY_REFRESH_INTERVAL="30000" #ETCD_PROXY_DIAL_TIMEOUT="1000" #ETCD_PROXY_WRITE_TIMEOUT="5000" #ETCD_PROXY_READ_TIMEOUT="0" # #[security] #ETCD_CERT_FILE="" #ETCD_KEY_FILE="" #ETCD_CLIENT_CERT_AUTH="false" #ETCD_TRUSTED_CA_FILE="" #ETCD_AUTO_TLS="false" #ETCD_PEER_CERT_FILE="" #ETCD_PEER_KEY_FILE="" #ETCD_PEER_CLIENT_CERT_AUTH="false" #ETCD_PEER_TRUSTED_CA_FILE="" #ETCD_PEER_AUTO_TLS="false" # #[logging] #ETCD_DEBUG="false" # examples for -log-package-levels etcdserver=WARNING,security=DEBUG #ETCD_LOG_PACKAGE_LEVELS="" # #[profiling] #ETCD_ENABLE_PPROF="false" #ETCD_METRICS="basic" |
follower安装过程:
# yum update
# yum install -y etcd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# [member] ETCD_NAME=etcd2 ETCD_DATA_DIR= "/var/lib/etcd/default.etcd"
#ETCD_WAL_DIR="" #ETCD_SNAPSHOT_COUNT="10000" ETCD_HEARTBEAT_INTERVAL= "1000"
ETCD_ELECTION_TIMEOUT= "10000"
ETCD_LISTEN_PEER_URLS= "http://10.10.0.49:2380"
ETCD_LISTEN_CLIENT_URLS= "http://10.10.0.49:2379,http://127.0.0.1:2379"
#ETCD_MAX_SNAPSHOTS="5" #ETCD_MAX_WALS="5" #ETCD_CORS="" # #[cluster] ETCD_INITIAL_ADVERTISE_PEER_URLS= "http://10.10.0.49:2380"
# if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test=http://..." ETCD_INITIAL_CLUSTER= "etcd1=http://10.10.0.103:2380,etcd2=http://10.10.0.49:2380"
#ETCD_INITIAL_CLUSTER_STATE="new" ETCD_INITIAL_CLUSTER_TOKEN= "etcd-cluster"
ETCD_ADVERTISE_CLIENT_URLS= "http://10.10.0.49:2379"
#ETCD_DISCOVERY="" #ETCD_DISCOVERY_SRV="" #ETCD_DISCOVERY_FALLBACK="proxy" #ETCD_DISCOVERY_PROXY="" #ETCD_STRICT_RECONFIG_CHECK="false" #ETCD_AUTO_COMPACTION_RETENTION="0" # #[proxy] #ETCD_PROXY="off" #ETCD_PROXY_FAILURE_WAIT="5000" #ETCD_PROXY_REFRESH_INTERVAL="30000" #ETCD_PROXY_DIAL_TIMEOUT="1000" #ETCD_PROXY_WRITE_TIMEOUT="5000" #ETCD_PROXY_READ_TIMEOUT="0" # #[security] #ETCD_CERT_FILE="" #ETCD_KEY_FILE="" #ETCD_CLIENT_CERT_AUTH="false" #ETCD_TRUSTED_CA_FILE="" #ETCD_AUTO_TLS="false" #ETCD_PEER_CERT_FILE="" #ETCD_PEER_KEY_FILE="" #ETCD_PEER_CLIENT_CERT_AUTH="false" #ETCD_PEER_TRUSTED_CA_FILE="" #ETCD_PEER_AUTO_TLS="false" # #[logging] #ETCD_DEBUG="false" # examples for -log-package-levels etcdserver=WARNING,security=DEBUG #ETCD_LOG_PACKAGE_LEVELS="" # #[profiling] #ETCD_ENABLE_PPROF="false" #ETCD_METRICS="basic" |
启动master和follower节点上etcd服务:
# systemctl start etcd
查看成员列表:
# etcdctl member list
30e9662cfab160c5: name=etcd2 peerURLs=http://10.10.0.49:2380 clientURLs=http://10.10.0.49:2379 isLeader=true
cedb09f4a212df57: name=etcd1 peerURLs=http://10.10.0.103:2380 clientURLs=http://10.10.0.103:2379 isLeader=false
查看集群状态:
# etcdctl cluster-health
member 30e9662cfab160c5 is healthy: got healthy result from http://10.10.0.49:2379
member cedb09f4a212df57 is healthy: got healthy result from http://10.10.0.103:2379
cluster is healthy