如何解决有关OverCommit_memory的REDIS服务警告?

问题描述 投票:0回答:1
在基于Yocto的Linux发行版中,我已经安装了一个使用AOF持久性策略的Redis 6.0.5实例。

由于我对Redis服务器的此实例有一些问题,所以我已经检查了SystemD服务的日志the命令:

redis.service

在此命令的输出中,我发现了以下警告:

journalctl -u redis | less
我正在尝试遵循警告提供的建议,但是在我的系统上,我找不到任何文件

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.

。因此,我试图应用同一警告提供的其他提示,并执行了命令:
/etc/sysctl.conf

可以在我的系统上执行以前的命令而不会出错,并给出输出:

sysctl vm.overcommit_memory=1
但是,当我重新启动系统时,警告始终存在于

vm.overcommit_memory = 1

服务期刊上。
因此,我尝试创建一个用以下内容创建一个文件:

redis

但是当我重新启动系统时,警告仍然存在。
我读过有关同一主题的其他一些帖子,例如this

,但是我没有找到有效的解决方案(许多链接都使用Docker,但这不是我的情况)。

我如何解决此警告?

	
thislink

我找到了以下句子:

此人页面描述了procps sysctl的配置文件。 如果您使用的是Systemd-Sysctl(8),请参阅Sysctl.d(5),并注意 它不会使用file/etc/sysctl.conf.

I发现我的Linux发行版正在使用/etc/sysctl.conf

,前面的句子说

vm.overcommit_memory = 1

不使用配置文件
redis yocto
1个回答
0
投票
。在句子中有一个link

,在其中我发现:

启动,systemd-sysctl.service(8)从目录中读取配置文件:
/etc/sysctl.d/

.conf

/run/sysctl.d/
.conf

/USR/local/lib/sysctl.d/

.conf
/USR/lib/sysctl.d/
.conf
配置sysctl(8)内核参数。
为了在系统中设置参数systemd-sysctl,我决定通过配置文件设置它;该文件的内容如下:

/etc/sysctl.conf


通过添加此文件,然后在重新启动后,通过执行以下命令可以看到,内核参数设置为vm.overcommit_memory = 1

/etc/sysctl.d/kernel_vm_overcommit_memory.conf
服务停止发出警告:

vm.overcommit_memory = 1

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.