MISCONF: Persistence is failing, writes stopped
Redis can't write its snapshot or AOF to disk. With RDB on, stop-writes-on-bgsave-error refuses writes to avoid silent data loss; a broken AOF refuses writes regardless.
- Error prefix
MISCONF- Категория
- Memory and persistence
Что это значит
MISCONF is Redis protecting durability. A background save failed (full disk, missing permissions, a dying volume) or the AOF is unwritable, and because stop-writes-on-bgsave-error defaults to yes, every command that could modify data is refused until persistence works again. Reads continue, which is what makes this error confusing: the server looks healthy and only writes fail.
The AOF variant reads MISCONF Errors writing to the AOF file: ... and names the reason. Both variants mean the same thing: Redis is telling you its durability promise is broken, not that your command is wrong. The fix is almost always on the disk: space, permissions, or the dir and dbfilename configuration.
Распространённые причины
- The disk holding the snapshot or AOF is full or has gone read-only.
- The user Redis runs as lacks write permission on dir, which is common after moving the data directory.
- The background-save child keeps failing, for instance on a host too loaded to fork, and the last save stays in error state.
Find the cause
INFO persistence # rdb_last_bgsave_status:err stops writes only while save points are set (CONFIG GET save is not empty) and stop-writes-on-bgsave-error is yes; aof_last_write_status:err stops writes whatever those settings are CONFIG GET dir CONFIG GET stop-writes-on-bgsave-error # Space and permissions in the actual save directory: df -h ls -la <dir-from-CONFIG-GET>
Persistence status fields to check
| rdb_last_bgsave_status | ok or err; err is what activates the write stop. |
|---|---|
| aof_last_write_status | ok or err for the append-only side; the AOF variant of MISCONF names it. |
| rdb_changes_since_last_save | How much data exists only in memory right now. |
| stop-writes-on-bgsave-error | The switch that turns a failed RDB save into refused writes, only while save points are set; yes by default. It does not affect AOF write errors. |
Как исправить
-
Read the exact persistence state; the status fields say which side failed:
INFO persistence # rdb_last_bgsave_status, aof_last_write_status
-
Check the disk and the directory Redis saves into:
CONFIG GET dir CONFIG GET dbfilename CONFIG GET appendonly df -h
-
Clear the cause, then force a save; writes resume once the status is ok:
BGSAVE INFO persistence | grep rdb_last_bgsave_status
Other ways to handle it
If this instance is a cache backed by another system of record, stop-writes-on-bgsave-error no removes the RDB write stop, accepting that a crash may lose the unsaved slice; it does not clear an AOF write error: a documented trade rather than an accident. Monitoring rdb_last_bgsave_status turns the problem into an ops alert instead of user-visible errors.
Безопасное воспроизведение
Run against a scratch instance: the directory is made unwritable on purpose so the background save fails the way it does on a full disk.
mkdir -p /private/tmp/redis-nowrite && chmod 000 /private/tmp/redis-nowrite redis-server --port 7307 --save '' & redis-cli -p 7307 CONFIG SET dir /private/tmp/redis-nowrite redis-cli -p 7307 CONFIG SET save '1 1' redis-cli -p 7307 SET x 1 # after about a second, once the failing save is recorded: redis-cli -p 7307 SET y 2 # (error) MISCONF Redis is configured to save RDB snapshots, ... chmod 755 /private/tmp/redis-nowrite && redis-cli -p 7307 BGSAVE # heals the status
Вопросы
Why are reads fine while writes fail?
The write stop is deliberate: Redis refuses to take writes it may not be able to save, while continuing to serve the data it already has.
I do not need persistence. Can I ignore MISCONF?
Turn persistence off properly (an empty save directive and appendonly no) instead of leaving a broken saver plus stop-writes-on-bgsave-error no. Then the state cannot surprise you later.
Связанные ошибки
SQLITE_IOERRSQLite: ошибка ввода-вывода диска58P01PostgreSQL: undefined fileSQLITE_READONLYSQLite: попытка записи в базу данных только для чтения
More memory and persistence errors
Код и текст сообщения взяты из Redis documentation and source code. Смотрите весь Redis error list или поиск по всем ошибкам баз данных.
Work on Redis in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Redis and the other databases you use.
Текст и данные на этой странице: CC BY 4.0, с указанием SQLly (sqlly.app). Код и фрагменты SQL: MIT. Подробнее о лицензии Цитируемый текст сообщений об ошибках принадлежит производителю СУБД.