etcd磁盘清理步骤

etcd默认的空间配额限制为2G,超出空间配额限制就会影响服务,所以需要定期清理

以下是etcd磁盘清理的步骤:

1. 显示空间配额: ETCDCTL_API=3 etcdctl --endpoints=$ip:$port --write-out=table endpoint status

2.查看告警: ETCDCTL_API=3 etcdctl --endpoints=$ip:$port alarm list 

3.获取当前etcd数据的修订版本(revision)

1)rev=$(ETCDCTL_API=3 etcdctl --endpoints=$ip:$port endpoint status --write-out="json" | egrep -o '"revision":[0-9]*' | egrep -o '[0-9].*')

2)echo $rev

4.整合压缩旧版本数据 :ETCDCTL_API=3 etcdctl --endpoints=$ip:$port compact $rev

5. 执行碎片整理: ETCDCTL_API=3 etcdctl --endpoints=$ip:$port defrag

6.解除告警 : ETCDCTL_API=3 etcdctl --endpoints=$ip:$port alarm disarm

7.验证可以添加新数据:ETCDCTL_API=3 etcdctl --endpoints=$ip:$port put newkeytestfornospace 123

猜你喜欢

转载自www.cnblogs.com/dapingguo/p/10331248.html
今日推荐