数据库-etcd常用命令

发布时间 2023-08-10 16:38:35作者: 少年老余

1.健康状态

#设置etcdctl 使用的版本,k8s中使用v3版本
export ETCDCTL_API=3
/apps/bin/etcdctl --cacert="/apps/conf/etcd/ssl/ca.pem" --cert="/apps/conf/etcd/ssl/member-GXGX-PSC-S1X2-SPOD2-PM-OS01-MYSQL-K8S01.pem" --key="/apps/conf/etcd/ssl/member-GXGX-PSC-S1X2-SPOD2-PM-OS01-MYSQL-K8S01-key.pem" endpoint health
/home/s/bin/etcdctl  --endpoints=https://11.0.1.149:2379,https://11.0.1.150:2379,https://11.0.1.151:2379  --cacert=/home/s/cert/kube_etcd/ca.pem --cert=/home/s/cert/kube_etcd/client.pem --key=/home/s/cert/kube_etcd/client-key.pem  endpoint health
https://11.0.1.151:2379 is healthy: successfully committed proposal: took = 19.705544ms
https://11.0.1.150:2379 is healthy: successfully committed proposal: took = 19.187536ms
https://11.0.1.149:2379 is healthy: successfully committed proposal: took = 23.052489ms
View Code
 
2.节点信息
/home/s/bin/etcdctl  --endpoints=https://11.0.1.149:2379,https://11.0.1.150:2379,https://11.0.1.151:2379  --cacert=/home/s/cert/kube_etcd/ca.pem --cert=/home/s/cert/kube_etcd/client.pem --key=/home/s/cert/kube_etcd/client-key.pem  member list
6e45a7efe4f43e72, started, 11.0.1.149, https://11.0.1.149:2380, https://11.0.1.149:2379, false
83b35c880ec44a22, started, 11.0.1.151, https://11.0.1.151:2380, https://11.0.1.151:2379, false
d0c21986d57fb7ce, started, 11.0.1.150, https://11.0.1.150:2380, https://11.0.1.150:2379, false
View Code

3.所有key

[root@localhost data]#  /home/s/bin/etcdctl  --endpoints=https://11.0.1.149:2379,https://11.0.1.150:2379,https://11.0.1.151:2379  --cacert=/home/s/cert/kube_etcd/ca.pem --cert=/home/s/cert/kube_etcd/client.pem --key=/home/s/cert/kube_etcd/client-key.pem  get / --prefix --keys-only 
/registry/apiregistration.k8s.io/apiservices/v1.

/registry/apiregistration.k8s.io/apiservices/v1.apps

/registry/apiregistration.k8s.io/apiservices/v1.authentication.k8s.io

/registry/apiregistration.k8s.io/apiservices/v1.authorization.k8s.io

/registry/apiregistration.k8s.io/apiservices/v1.autoscaling
View Code