etcdserver: mvcc: database space exceeded 解决办法

1050阅读 0评论2023-03-02 jiuniu110
分类:服务器与存储

以下是官方回答:
What does “mvcc: database space exceeded” mean and how do I fix it?
The multi-version concurrency control data model in etcd keeps an exact history of the keyspace. Without periodically compacting this history (e.g., by setting --auto-compaction), etcd will eventually exhaust its storage space. If etcd runs low on storage space, it raises a space quota alarm to protect the cluster from further writes. So long as the alarm is raised, etcd responds to write requests with the error mvcc: database space exceeded.
可以确认下使用空间

  1. ETCDCTL_API=3 etcdctl --write-out=table endpoint status



解决办法:


1. 手动清理历史数据

  1. # get current revision
  2. $ rev=$(ETCDCTL_API=3 etcdctl --endpoints=:2379 endpoint status --write-out="json" | egrep -o '"revision":[0-9]*' | egrep -o '[0-9].*')
  3. # compact away all old revisions
  4. $ ETCDCTL_API=3 etcdctl compact $rev
  5. compacted revision 1516
  6. # defragment away excessive space
  7. $ ETCDCTL_API=3 etcdctl defrag
  8. Finished defragmenting etcd member[127.0.0.1:2379]
  9. # disarm alarm
  10. $ ETCDCTL_API=3 etcdctl alarm disarm
  11. memberID:13803658152347727308 alarm:NOSPACE
  12. # test puts are allowed again
  13. $ ETCDCTL_API=3 etcdctl put newkey 123
  14. OK
2. 自动清理

Auto Compaction

etcd can be set to automatically compact the keyspace with the --auto-compaction-* option with a period of hours:

# keep one hour of history $ etcd --auto-compaction-retention=1

上一篇:ffmpeg主备推流
下一篇:nodejs下调试cpu100%的方法