OpenShift 4.x HOL教程汇总
说明:本文已经在 OpenShift 4.12 集群和 OpenShift Local 环境中验证,以下以 OpenShift Local 为例。

  1. 查看在 openshift-etcd 中运行 etcd 的 Pod,
$ oc get pod -n openshift-etcd
NAME                      READY   STATUS    RESTARTS   AGE
etcd-crc-pbwlw-master-0   5/5     Running   0          38d
 
$ oc rsh  -n openshift-etcd etcd-crc-pbwlw-master-0
Defaulted container "etcdctl" out of: etcdctl, etcd, etcd-metrics, etcd-health-monitor, etcd-readyz, setup (init), etcd-ensure-env-vars (init), etcd-resources-copy (init)
  1. 执行命令查看当前 etcd 数据库实例的 DB SIZE。
sh-4.4# etcdctl endpoint status -w table --cluster
+-----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|          ENDPOINT           |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+-----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| https://192.168.126.11:2379 | 5c468d7f95fd92ea |   3.5.5 |  107 MB |      true |      false |         8 |      93413 |              93413 |        |
+-----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
  1. 执行命令整理 etcd 数据库实例碎片。
sh-4.4# unset ETCDCTL_ENDPOINTS
sh-4.4# etcdctl --command-timeout=30s --endpoints=https://localhost:2379 defrag
Finished defragmenting etcd member[https://localhost:2379]
  1. 再次查看当前 etcd 数据库实例的 DB SIZE,确认已经变小了。
sh-4.4# etcdctl endpoint status -w table --cluster
+-----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|          ENDPOINT           |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+-----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| https://192.168.126.11:2379 | 5c468d7f95fd92ea |   3.5.5 |   52 MB |      true |      false |         8 |      95472 |              95472 |        |
+-----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐