redis服务启动内存不够问题

在学习redis的时候,每次启动redis都会报错

WARNNG Memory overcommit must be enabled! Without it. a backaround save or replication may fail under low memory
conditon. Being disabled, it can also cause failures without ow memory condition. see https://github.com/jemaloc/jemalloc/issues/1328. To fix this issue add vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysct
vm.overcommit_memory=1’ for this to take effect

问题说的很明显,内存不够,需要在/etc/sysctl.conf文件夹下添加一行代码,该文件为只读文件,需要使用管理员身份来修改

先进入管理员状态

sudo su

然后打开对应文件,添加如下代码,前面没有#

vm.overcommit_memory=1

然后重启虚拟机即可