SAVE, and restore it from a snapshot file with LOAD. Snapshots use the binary .rdbx format.
Syntax
Parameters
Path to the snapshot file. If the filename does not end with
.rdbx, the extension is appended automatically.Return value
Both commands returnOK on success.
Errors
| Command | Condition | Error message |
|---|---|---|
SAVE | Could not write to disk | (error) could not write file |
LOAD | File not found | (error) could not open file |
LOAD | File is corrupt or not RDBX format | (error) invalid RDBX file |
| Either | Wrong number of arguments | (error) wrong number of arguments for 'SAVE' / 'LOAD' |
Examples
Save the current database state and restore it after modifications:.rdbx extension is added automatically:
Notes
After
LOAD, the expiry sweeper is re-initialized (expire_init) so that TTL-based background expiry resumes correctly for keys restored from the snapshot.Snapshots complement the append-only file (AOF) but do not replace it. After
LOAD, the AOF continues to record all subsequent mutations. Consider taking a snapshot before destructive operations as an additional recovery point.