Redis 安装、部署简单,但是当数据量比较大的情况下,会出现各种问题,以下问题主要是出现在 key count > 2kw 的情况
1. Redis “MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk”,问题的原因是系统内存已经被耗尽,导致数据保存失败。日志中会出现以下提示消息:
“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 this to take effect.”(警告:过量使用内存设置为0!在低内存环境下,后台保存可能失败。为了修正这个问题,请在/etc/sysctl.conf 添加一项 'vm.overcommit_memory = 1' ,然后重启(或者运行命令'sysctl vm.overcommit_memory=1' )使其生效。
至于为什么需要设置 vm.overcommit_memory=1,参考文章 "redis overcommit memory (oom) 问题解决" 以及 "how-does-vm-overcommit-memory-work" 后大致明白了其含义。
参考文章:
- Redis "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk"问题的解决(转),点击访问