On my Yocto based Linux distribution I have installed an instance of Redis 6.0.5 which use AOF persistence policy.
Because I'm having some problems with this instance of Redis Server I have checked the log of the systemd service redis.service
by the command:
journalctl -u redis | less
In the output of this command I have found the following Warning:
redis-server[320]: 320:M 19 Feb 2025 15:40:12.802 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. 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 th
is to take effect.
I'm trying to follow the suggestion provided by the warning, but on my system I don't find any file /etc/sysctl.conf
. So I have tried to apply the other hint provided by the same warning, and I have executed the command:
sysctl vm.overcommit_memory=1
The previous command can be executed on my system without error and gives the output:
vm.overcommit_memory = 1
But when I restart my system the warning is always present on the journal of the redis
service.
So I have tried to create a file /etc/sysctl.conf
with the following content:
vm.overcommit_memory = 1
but when I reboot my system the warning is still present.
I have read some other posts about the same topic, for example this, but I haven't found a valid solution (many of the links use Docker, but it is not my case).
How can I solve this warning?