posts - 359,comments - 0,views - 19万

1.1 使用脚本下载与服务端相同版本的 etcdctl 软件包

[shutang@centos03.com etcd]$ pwd
/home/shutang/k8s/etcd
[shutang@centos03.com etcd]$ ls
download.sh
[shutang@centos03.com etcd]$ cat download.sh
#!/bin/bash
ETCD_VER=v3.4.3
ETCD_DIR=etcd-download
DOWNLOAD_URL=https://github.com/coreos/etcd/releases/download

# Download
mkdir ${ETCD_DIR}
cd ${ETCD_DIR}
wget ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar -xzvf etcd-${ETCD_VER}-linux-amd64.tar.gz

# install
cd etcd-${ETCD_VER}-linux-amd64
cp etcdctl /usr/local/bin/

1.2 执行脚本,然后配置环境变量和别名

[shutang@centos03.com etcd] bash download.sh

# 创建该文件
[shutang@centos03.com profile.d]$ cat etcd.sh
export ETCDCTL_API=3
alias etcdctl='etcdctl --endpoints=https://centos01.com:2379,https://centos02.com:2379,https://centos03.com:2379 --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key'

[shutang@centos03.com profile.d]$ source etcd.sh
# 这里需要注意要保证两个证书文件和一个私钥文件具有可读权限,以便普通用户可以使用 etcdctl 命令

2 普通用户可以使用 etcdctl 命令

2.1 查看 etcd 集群成员列表

[shutang@centos03.com profile.d]$ etcdctl member list
fw57bbcfbe9bc95, started, centos03.com, https://192.168.0.100:2380, https://192.168.0.100:2379, false
ds8968b39130b7a, started, centos02.com, https://192.168.0.101:2380, https://192.168.0.101:2379, false
fs663af9b5wfr85, started, centos01.com, https://192.168.0.102:2380, https://192.168.0.102:2379, false

2.2 查看 endpoints 状态

[shutang@centos03.com profile.d]$ etcdctl endpoint status --write-out=table
+------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|           ENDPOINT           |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| https://centos03.com:2379 |  fw57bbcfbe9bc95 |   3.4.3 |   36 MB |      true |      false |         4 |    8387884 |            8387884 |        |
| https://centos03.com:2379 | ds8968b39130b7a |   3.4.3 |   36 MB |     false |      false |         4 |    8387884 |            8387884 |        |
| https://centos03.com:2379 |  fs663af9b5wfr85 |   3.4.3 |   36 MB |     false |      false |         4 |    8387884 |            8387884 |        |
+------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+

2.3 查看 etcd endpoints 的健康

[shutang@centos03.com profile.d]$ etcdctl endpoint health
https://centos03.com:2379 is healthy: successfully committed proposal: took = 12.253777ms
https://centos02.com:2379 is healthy: successfully committed proposal: took = 13.902653ms
https://centos01.com:2379 is healthy: successfully committed proposal: took = 15.32191ms
posted on   属于我的梦,明明还在  阅读(591)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5

点击右上角即可分享
微信分享提示