Closed mobius77 closed 9 months ago
@mobius77 What is stored in this etcd cluster?
In my case, the etcd cluster used by two Patroni clusters for the last 5 years takes about 370M
postgres@pgnode01:~$ sudo du -sh /var/lib/etcd/
370M /var/lib/etcd/
The error you're encountering, "etcdserver: mvcc: database space exceeded," indicates that your etcd database has reached its storage limit. This can hinder the operation of services relying on etcd, like Patroni. Here are some steps to address this issue:
Increase the Database Size Limit:
--quota-backend-bytes
flag when starting the etcd server. For example, to increase it to 4 GB, you would use --quota-backend-bytes=4294967296
(as 4 GB is 4,294,967,296 bytes).Compact and Defrag the Database:
etcdctl compact
and etcdctl defrag
. Compacting the database removes old revisions of keys and values, which can free up space. After compacting, defragmentation is necessary to reclaim this space physically.etcdctl compact <revision>
.etcdctl defrag
on each member of the etcd cluster.Free up Space by Deleting Unnecessary Data:
Snapshot and Restore:
etcdctl snapshot save
to take a snapshot and etcdctl snapshot restore
to restore it.Monitor and Manage Storage:
Review etcd Usage:
Upgrade etcd (if applicable):
Before making any changes, especially those involving data deletion or snapshot and restore, ensure you have a recent backup of the etcd data. Also, consider testing these procedures in a non-production environment first to understand their impact and effectiveness.
@mobius77 You can increase the database quota in etcd (e.q. to 4 GB) by adding an option to the configuration file /etc/etcd/etcd.conf
ETCD_QUOTA_BACKEND_BYTES="4294967296"
This setting sets the etcd database size quota to 4 GB. After adding this line to the configuration file, you will need to restart etcd for the changes to take effect.
https://etcd.io/docs/v3.4/op-guide/configuration/#--quota-backend-bytes
PR (auto_compaction): https://github.com/vitabaks/postgresql_cluster/pull/562
I've got error from patroni: etcdserver: mvcc: database space exceeded
etcdctl compact and etcdctl defrag didn't help.
How i can increase limit for etcd or how to compress DB?
Please help.