How To Resolve Redis' `MISCONF` Error

Here's the error:

MISCONF Redis is configured to save RDB snapshots, but is currently not able to
persist on disk. Commands that may modify the data set are disabled. Please
check Redis logs for details about the error.

It means that Redis is not able to save data on the disk. This error occurs because of BGSAVE being failed. During BGSAVE, Redis forks a child process to save the data on disk.

Redis doesn't need as much memory as the OS thinks it does to write to disk, so may pre-emptively fail the fork.

Set vm.overcommit_memory to 1 in the /etc/sysctl.conf:


And then, restart the ~sysctl~ process:

sudo sysctl -p /etc/sysctl.conf

Important: Setting the stop-writes-on-bgsave-error option to no in Redis doesn't solve the problem, it just ignores it.

Subscribe to My Newsletter

The latest programming-related news, articles and resources - sent to your inbox monthly. Unsubscribe anytime.