How to Fix Redis MISCONF: Persistence Save Failed
Quick Fix Summary
TL;DRRun `CONFIG SET stop-writes-on-bgsave-error no` to restore write operations, then investigate and resolve the underlying disk or permission issue.
Redis failed to save its dataset to disk (RDB snapshot) during a background save (BGSAVE). This triggers the MISCONF error and blocks all write operations to prevent data inconsistency.
Diagnosis & Causes
Recovery Steps
Step 1: Immediate Mitigation - Restore Write Operations
First, reconnect write capability to your application. This command tells Redis to continue accepting writes even if background saves fail. Use this ONLY as a temporary fix.
redis-cli CONFIG SET stop-writes-on-bgsave-error no Step 2: Diagnose Disk Space and Inodes
Check for the most common root cause: lack of storage. Verify both available disk space and inode count.
df -h /path/to/redis/data
df -i /path/to/redis/data Step 3: Verify Directory Permissions and Ownership
Ensure the Redis user (often `redis`) has write permissions to the directory specified by `dir` in the configuration.
ls -la /var/lib/redis/
sudo chown -R redis:redis /var/lib/redis
sudo chmod 755 /var/lib/redis Step 4: Check Redis Logs for Specific Error
Examine the Redis server logs (location defined in `logfile` or systemd/journalctl) for the exact error message from the failed BGSAVE.
sudo tail -100 /var/log/redis/redis-server.log
sudo journalctl -u redis.service --no-pager -n 50 Step 5: Manually Trigger a Save to Test
After addressing potential issues, test if persistence now works by forcing a save. Use SAVE (blocks) or BGSAVE (background).
redis-cli SAVE
# Check for 'OK' response Step 6: Re-enable Safe Mode (Post-Recovery)
Once the root cause is fixed, re-enable the protective setting to prevent future silent data loss on save failures.
redis-cli CONFIG SET stop-writes-on-bgsave-error yes
# Persist the change to redis.conf: `stop-writes-on-bgsave-error yes` Step 7: Adjust Persistence Strategy (If Needed)
If disk I/O is the bottleneck, consider less frequent saves, switching to AOF, or upgrading infrastructure.
# Example: Change from save 900 1 300 10 60 10000
# to save 3600 1 300 100 Architect's Pro Tip
"In containerized environments (Docker/K8s), this error often stems from the ephemeral container filesystem filling up. Mount a persistent volume and ensure `vm.overcommit_memory=1` is set on the host."
Frequently Asked Questions
Is it safe to set `stop-writes-on-bgsave-error` to `no` permanently?
No. This disables a critical safety feature. If saves consistently fail, your in-memory data will diverge from disk, leading to complete data loss if Redis restarts. Use it only as a temporary bypass.
The disk has space, but the error persists. What next?
Check for I/O errors in `dmesg`, ensure SELinux/AppArmor isn't blocking Redis, and verify the filesystem isn't read-only. Also, test writing a file manually to the `dir` location as the Redis user.
How does this error differ from a `MISCONF` error about `maxmemory`?
Both are `MISCONF` but have different causes. `maxmemory` is triggered when the memory limit is reached and no eviction policy is set. This guide specifically addresses the `persistence save failed` variant.