MISCONF Redis is configured to save RDB snapshots

I am using Redis on AWS EC2 after few hours when a client tries to set any key. Redis throw MISCONF error. How to fix it properly.

I found following solution but It’s not good enough

config set stop-writes-on-bgsave-error no

This error can occur because BGSAVE fails. Often BGSAVE fails because the fork can’t allocate memory. Many times the fork fails to allocate memory (although the machine has enough RAM available) because of conflicting optimization by the OS.

A quick workaround is to use redis-cli : config set stop-writes-on-bgsave-error no

If you care about the data you are using it for, you should check to see why BGSAVE failed in first place.

There might be errors during the BGSAVE process due to low memory.

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

Setting overcommit_memory to 1 tells Linux to relax and perform the fork in a more optimistic allocation fashion, and this is what you want for Redis.

# echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
# sysctl vm.overcommit_memory=1

sysctl vm.overcommit_memory=1 is throwing Unknown Key error and its not allowing to set from within a container