GrepBoard/Manuals
605 manuals ·

Fix Redis MISCONF: unable to persist to disk (RDB snapshots)

·Tested on Redis 7.4.12 (Docker redis:7) · 2026-10·Test scope ↓·7 steps

Redis MISCONF unable to persist to disk means the last RDB save failed and writes are blocked. Find the cause in the log, fix it, then run BGSAVE.

output
MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.

The last RDB background save (BGSAVE) failed, so Redis rejects write commands. Fix the reason the log gives (data directory permissions, disk space, or fork failure), and writes are allowed again as soon as one BGSAVE succeeds. Reads keep working in the meantime.

[1] Confirm the save is in the failed state. rdb_last_bgsave_status:err means this is your case; rdb_changes_since_last_save is the number of changes not yet on disk.

console
$ redis-cli INFO persistence | grep -E 'rdb_last_bgsave_status|rdb_changes_since_last_save|rdb_last_save_time|rdb_bgsave_in_progress'rdb_changes_since_last_save:1rdb_bgsave_in_progress:0rdb_last_save_time:1793087013rdb_last_bgsave_status:err$ redis-cli GET k1v1

As the redis.conf comments explain, when at least one save point (save) is set and the last background save failed, the default stop-writes-on-bgsave-error yes stops writes. It is meant to make you notice, "in a hard way", that data is not reaching disk.

[2] Read the reason in the Redis log. For a container use docker logs <container>; for a package install, the file set by logfile in redis.conf. These are real log lines for an unwritable data directory and for a full disk.

output
37:C 27 Oct 2026 07:43:36.021 # Failed opening the temp RDB file temp-37.rdb (in server root dir /data) for saving: Permission denied1:M 27 Oct 2026 07:43:36.051 # Background saving error
output
28:C 27 Oct 2026 07:43:56.839 # Write error while saving DB to the disk(rdbSaveRio): No space left on device1:M 27 Oct 2026 07:43:56.844 # Background saving error
End of the log lineCauseGo to
Permission deniedThe Redis user cannot write to dir[3]
No space left on deviceThe filesystem holding dir is full[4]
fork-related failureNot enough memory to create the child process[5]

[3] For permissions, give the data directory to the Redis user. Get the directory with CONFIG GET dir and the user with id.

console
$ redis-cli CONFIG GET dirdir/data$ ls -ld /datadr-xr-xr-x 2 root root 6 Oct 27 07:44 /data$ iduid=999(redis) gid=999(redis) groups=999(redis)

The directory is owned by root with r-x, so redis (999) cannot create its temp file. After changing the owner (chown redis:redis /data; in the test, chown 999:999 and chmod 750 on the mounted host directory) it looks like this:

console
$ ls -ld /datadrwxr-x--- 2 redis redis 6 Oct 27 07:44 /data
console
$ redis-cli CONFIG SET dir /tmpERR CONFIG SET failed (possibly related to argument 'dir') - can't set protected config

[4] For a full disk, free space first. Check the filesystem holding dir with df -h, and follow Find what filled the disk. If you cannot grow it, dir has to move to a larger filesystem, which per the note in [3] means editing the config file and restarting. Do not delete dump.rdb in that directory; it is the last successful save.

[5] For fork failures, check the kernel memory setting. The test container printed this warning at startup:

output
1:C 27 Oct 2026 07:43:33.723 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

The Redis administration guide also recommends vm.overcommit_memory = 1 and links to the fork error FAQ (Redis administration). It is a host kernel setting, so it cannot be changed from inside a container, and it affects the whole server; decide together with the other services on that host. The same guide notes that a write-heavy instance can use up to twice its normal memory while saving.

[6] After fixing the cause, run BGSAVE again and check the status. Once it succeeds, writes are allowed immediately.

console
$ redis-cli BGSAVEBackground saving started$ redis-cli INFO persistence | grep -E 'rdb_last_bgsave_status|rdb_changes_since_last_save'rdb_changes_since_last_save:0rdb_last_bgsave_status:ok$ redis-cli SET k2 v2OK

The log shows DB saved on disk and Background saving terminated with success.

[7] If you must restore writes right now, turn stop-writes-on-bgsave-error off temporarily. Anything written meanwhile is not on disk and is lost on restart. Use it only while you fix the cause, then turn it back on.

console
$ redis-cli CONFIG SET stop-writes-on-bgsave-error noOK$ redis-cli SET x 1OK$ redis-cli CONFIG SET stop-writes-on-bgsave-error yesOK$ redis-cli SET x 2MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk. …

Writes are blocked again after turning it back on, because the last save status is still err; only a successful BGSAVE from step [6] clears it. If the instance is a pure cache that needs no persistence, the right setting is save "" to remove RDB save points, not disabling this check.

OOM command not allowed is a different error caused by memory limits; see Redis OOM command not allowed. If writes are not blocked in general but one key returns WRONGTYPE Operation against a key, saving has nothing to do with it — the key's data type does not match the command; see Redis WRONGTYPE Operation against a key.

#redis#misconf#rdb#bgsave#persistence