问题现象
本地redis测试环境,突然老写不成功,命令行执行set或者del操作,报错如下
127.0.0.1:6379> del act_1
(error) 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.
原因分析
按报错提示,Redis无法将缓存中的数据写入本地磁盘。
原因有三:
- 磁盘满了:查看和清理磁盘
- redis配置问题:config set stop-writes-on-bgsave-error no
- 操作权限问题:通过查看日志分析
解决方法
最终检查发现自己本地环境的问题是配置问题
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
127.0.0.1:6379> del act_1
(integer) 1