长沙市建网站,苏州建网站多少钱,7免费网站建站,WordPress 发布文章 api今天同事反应测试环境业务一直报错#xff0c;好像是redis持久化出现了问题#xff0c;并给出了错误信息#xff0c;让我帮忙看一下#xff0c;说明明还有2G内存为何还会报错
MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persis…今天同事反应测试环境业务一直报错好像是redis持久化出现了问题并给出了错误信息让我帮忙看一下说明明还有2G内存为何还会报错
MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.. channel: [id: 0xb07fbbd2, L:/10.4.11.84:43534 - R:ruigecloud-redis/10.4.11.165:6379] command: (EXPIRE), params: [[49, 51, 58, 114, 117, 105, 103, 101, 99, 108, ...], 2592000]
我想内存不够用通常导致持久化失败但同事告知还有2G内存我大致明白问题出在哪里了
问题主要有以下几个方面
1、内存确实没有不够没有合理化分配 解释Redis在保存数据时为避免主进程假死会Fork一份主进程Fork进程完成数据保存到硬盘的操作若主进程用了4GBFork子进程的时候需要额外的4GB所以内存确实不够了 2、临时处理日志中有提示“because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option).”
连接redis后运行 config set stop-writes-on-bgsave-error no 命令 提示仅仅是让程序忽略了这个异常使得程序能够继续往下运行但实际上数据还是会存储到硬盘失败 3、为了看日志方便一定要配置日志路径
修改配置文件设置logfile 4、低内存环境下修正后台保存失败问题。 /etc/sysctl.conf 末尾添加 vm.overcommit_memory 1 sysctl -p 目前为止此问题暂时解决还需要对Redis的相关配置进行优化
5、配置日志文件、日志级别 loglevel notice logfile /data/log/redis-6379.log 6、做好内存容量规划设置回收策略 maxmemory 4294967296 maxmemory-policy volatile-lru 允许长期不活跃的数据从Redis丢失 dir 路径 dbfilename dump6379.rdb 7、重启redis Redis的重启不要kill 127.0.0.1:6379 SHUTDOWN