首页 > 数据库 >MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk

MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk

时间:2023-01-13 14:34:09浏览次数:44  
标签:MISCONF error overcommit Redis able redis vm memory disk

早上一上班发现系统登录不上去了,查看后台日志:
Caused by: io.lettuce.core.RedisCommandExecutionException: 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.

经过百度查询发现问题出现在Redis上,用的好好地为啥Redis出问题呢

解决方法:
1.登录redis-cli输入命令:config set stop-writes-on-bgsave-error no
2.是直接修改redis.conf配置文件,修改redis.conf文件:vim打开redis-server配置的redis.conf文件,然后使用快捷匹配模式:/stop-writes-on-bgsave-error定位到stop-writes-on-bgsave-error字符串所在位置,接着把后面的yes设置为no即可。
任意一种方式即可。
详细了解 stop-writes-on-bgsave-error 设置

stop-writes-on-bgsave-error 选项

如果 = yes : redis 会创建一个新的后台进程dump rdb。
假设 :创建快照(硬盘上,产生一个新的rdb文件)需要 20s时间,redis主进程,在这20s内,会继续接受客户端命令,但是,就在这20s,内,创建快照!!!,出错了,比如磁盘满了,那么redis会认为,
当前!!!,Redis is configured to save RDB snapshots, but is currently not able to persist on disk. but is currently not able to persist on disk.
那么,redis会,拒绝 新的写入,也就是说,它认为,你当下,持久化数据出现了问题,你就不要再set啦。

有建议设置参数“config set stop-writes-on-bgsave-error no”。但这样子只是暂时性的,问题依旧没有解决。


linux中 vm.overcommit_memory 的含义

一、vm.overcommit_memory的作用

Linux系统对大部分进行内存申请的程序都回复yes,以便能运行更多的程序。而这些程序申请内存后并不一定会马上使用,这种技术就叫做overcommit。通过vm.overcommit_memory来设置overcommit的内存分配策略,它有三个可选值

0:内核将检查是否有足够的内存分配给程序。如果没有则申请失败,并把错误返回给应用进程。而在Redis中这个错误就会表现为“Cannot allocate memory”,然后触发OOM
1:表示内核允许超量使用内存直到用完为止
2:表示内核决不超量使用内存,即系统整个内存空间不能超过swap+50%的RAM值,50%是overcommit_ratio默认值,此参数支持修改

二、vm.overcommit_memory在Redis中的设置

Redis建议把这个值设置为1,是为了让fork能够在低内存下也执行成功。

1、获取overcommit的值


cat /proc/sys/vm/overcommit_memory​

2、设置overcommit的值 


​echo ​​​​"vm.overcommit_memory=1"​​​ ​​>> /etc/sysctl.conf​

​sysctl vm.overcommit_memory=1​


标签:MISCONF,error,overcommit,Redis,able,redis,vm,memory,disk
From: https://blog.51cto.com/u_2368787/6005925

相关文章