5.1.5.4.1. Compaction
Compaction in etcd is the process of removing old data versions (revisions) from storage. In etcd, all write operations create new key revisions, allowing clients to access historical data. However, over time, the accumulation of these revisions leads to increased disk space usage and slower cluster performance.
5.1.5.4.1.1. How it works
-
Compaction can be triggered automatically based on a policy (e.g., by time or number of revisions) or manually using the etcdctl compact command.
-
During compaction, etcd removes revisions older than the specified revision index. This means clients can no longer access data before this index.
-
Internal data structures are updated to reflect the removal of old revisions.
5.1.5.4.1.2. Prerequisites
-
With intensive write and delete operations, etcd quickly accumulates historical revisions.
-
Without compaction, the database size will continuously grow, which can lead to disk space exhaustion.
-
Too many revisions can slow down etcd performance, especially when querying historical data.
5.1.5.4.1.3. Instructions
Please note that there is an external dependency on aliases.
- etcdctl
- ectl
- nectl
etcdctlCompaction
ectlCompaction
nectlCompaction
On successful command execution, you will get the following message.
compacted revision 75704