etcd defrag bug [3.1.4] 之前通病

目的

由于 etcd DB 大
需要对 db 执行 defrag 操作

BUG

db 更大了

解决方法

升级 etcd 至 3.14 以后版本

现象

查询集群状态

[apps@GD9-xxx-002 ~]$ /apps/svr/etcd/bin/etcdctl cluster-health
member 1abxxxx77d2 is healthy: got healthy result from http://10.200.121.88:2379
member 30xxxxx59da is healthy: got healthy result from http://10.200.121.92:2379
member 37xxx522194 is healthy: got healthy result from http://10.200.121.90:2379
member 3exxxx3c5cb is healthy: got healthy result from http://10.200.121.91:2379
member dfxxxe3e85b is healthy: got healthy result from http://10.200.121.89:2379
cluster is healthy

开始时的磁盘空间大小 1.1GB

[apps@GD9-xxx-001 ~]$ ETCDCTL_API=3 /apps/svr/etcd/bin/etcdctl endpoint status -w table
+----------------+------------------+---------+---------+-----------+-----------+--------------+
|    ENDPOINT    |        ID        | VERSION | DB SIZE | IS LEADER | RAFT TERM |  RAFT INDEX  |
+----------------+------------------+---------+---------+-----------+-----------+--------------+
| 127.0.0.1:2379 | 1axxxxxxxxxe77d2 | 3.0.6   | 1.1 GB  | false     |       993 | 137305385788 |
+----------------+------------------+---------+---------+-----------+-----------+--------------+

备份

[apps@GD9-xxxx-001 ~]$ ETCDCTL_API=3 /apps/svr/etcd/bin/etcdctl  snapshot save /home/apps/backup/$(date +%F)/k8s_etcd_$(hostname)_$(date +%F-%H-%M).db
Snapshot saved at /home/apps/backup/2021-01-21/k8s_etcd_GD9-xxxx-001_2021-01-21-15-41.db

$ ls /home/apps/backup/2021-01-21/k8s_etcd_GD9-xxxx-001_2021-01-21-15-41.db -lh
-rw-rw-r-- 1 apps apps 1.1G Jan 21 15:42 /home/apps/backup/2021-01-21/k8s_etcd_GD9-xxxxx-001_2021-01-21-15-41.db
```
执行 defrag
```
ETCDCTL_API=3 /apps/svr/etcd/bin/etcdctl --command-timeout=60000s defrag

结束后 DB 变大了

[apps@GD9-xxx-001 etcd-3.0.6]$ ETCDCTL_API=3 /apps/svr/etcd/bin/etcdctl endpoint status -w table
+----------------+------------------+---------+---------+-----------+-----------+--------------+
|    ENDPOINT    |        ID        | VERSION | DB SIZE | IS LEADER | RAFT TERM |  RAFT INDEX  |
+----------------+------------------+---------+---------+-----------+-----------+--------------+
| 127.0.0.1:2379 | 1axxxxxxxxxx77d2 | 3.0.6   | 2.0 GB  | false     |       993 | 137308566408 |
+----------------+------------------+---------+---------+-----------+-----------+--------------+

参考 GIT BUG REPORT

https://github.com/etcd-io/etcd/issues/7551

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Terry_Tsang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值