Skip to content

Commit e58c6a8

Browse files
committed
update etcd docs
1 parent daba13b commit e58c6a8

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

docs/setup/02-install_etcd.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,29 +96,51 @@ WantedBy=multi-user.target
9696
# 根据hosts中配置设置shell变量 $NODE_IPS
9797
export NODE_IPS="192.168.1.1 192.168.1.2 192.168.1.3"
9898
for ip in ${NODE_IPS}; do
99-
ETCDCTL_API=3 etcdctl \
99+
etcdctl \
100100
--endpoints=https://${ip}:2379 \
101101
--cacert=/etc/kubernetes/ssl/ca.pem \
102102
--cert=/etc/kubernetes/ssl/etcd.pem \
103103
--key=/etc/kubernetes/ssl/etcd-key.pem \
104104
endpoint health; done
105105

106+
# 预期结果
107+
https://192.168.1.1:2379 is healthy: successfully committed proposal: took = 2.210885ms
108+
https://192.168.1.2:2379 is healthy: successfully committed proposal: took = 2.784043ms
109+
https://192.168.1.3:2379 is healthy: successfully committed proposal: took = 3.275709ms
110+
106111
for ip in ${NODE_IPS}; do
107-
ETCDCTL_API=3 etcdctl \
112+
etcdctl \
108113
--endpoints=https://${ip}:2379 \
109114
--cacert=/etc/kubernetes/ssl/ca.pem \
110115
--cert=/etc/kubernetes/ssl/etcd.pem \
111116
--key=/etc/kubernetes/ssl/etcd-key.pem \
112117
--write-out=table endpoint status; done
113-
```
114-
预期结果:
115118

116-
``` text
117-
https://192.168.1.1:2379 is healthy: successfully committed proposal: took = 2.210885ms
118-
https://192.168.1.2:2379 is healthy: successfully committed proposal: took = 2.784043ms
119-
https://192.168.1.3:2379 is healthy: successfully committed proposal: took = 3.275709ms
119+
# 预期结果
120+
+----------------------------+------------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
121+
| ENDPOINT | ID | VERSION | STORAGE VERSION | DB SIZE | IN USE | PERCENTAGE NOT IN USE | QUOTA | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS | DOWNGRADE TARGET VERSION | DOWNGRADE ENABLED |
122+
+----------------------------+------------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
123+
| https://192.168.1.1:2379 | 5f64925bd78a482c | 3.6.4 | 3.6.0 | 38 MB | 28 MB | 28% | 8.6 GB | true | false | 269 | 6582307 | 6582307 | | | false |
124+
+----------------------------+------------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
125+
+----------------------------+-----------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
126+
| ENDPOINT | ID | VERSION | STORAGE VERSION | DB SIZE | IN USE | PERCENTAGE NOT IN USE | QUOTA | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS | DOWNGRADE TARGET VERSION | DOWNGRADE ENABLED |
127+
+----------------------------+-----------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
128+
| https://192.168.1.2:2379 | 18e1b1602639adb | 3.6.4 | 3.6.0 | 37 MB | 28 MB | 25% | 8.6 GB | false | false | 269 | 6582307 | 6582307 | | | false |
129+
+----------------------------+-----------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
130+
+----------------------------+------------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
131+
| ENDPOINT | ID | VERSION | STORAGE VERSION | DB SIZE | IN USE | PERCENTAGE NOT IN USE | QUOTA | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS | DOWNGRADE TARGET VERSION | DOWNGRADE ENABLED |
132+
+----------------------------+------------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
133+
| https://192.168.1.3:2379 | 3d375f7546465b4e | 3.6.4 | 3.6.0 | 37 MB | 28 MB | 26% | 8.6 GB | false | false | 269 | 6582308 | 6582308 | | | false |
134+
+----------------------------+------------------+---------+-----------------+---------+--------+-----------------------+--------+-----------+------------+-----------+------------+--------------------+--------+--------------------------+-------------------+
120135
```
121-
三台 etcd 的输出均为 healthy 时表示集群服务正常。
136+
137+
- 所有节点可达:etcdctl endpoint health 对所有三个节点都返回 healthy。
138+
- 有且仅有一个领导者:etcdctl endpoint status 显示一个节点 is leader: true,另外两个节点 is leader: false。
139+
- Raft 任期一致:所有三个节点的 raft term 值完全相同。
140+
- Raft 索引同步:所有节点的 raft index 值相差不大(跟随者与领导者的差距在可接受范围内)。
141+
- 无活跃告警:etcdctl alarm list 返回空。
142+
- 节点间网络稳定:没有频繁的领导者切换(通过监控 etcd_server_leader_changes_seen_total 指标)。
143+
- 磁盘空间充足:没有 NOSPACE 告警,且磁盘使用率在安全阈值内(例如低于80%)。
122144
123145
### 磁盘性能
124146

0 commit comments

Comments
 (0)