解决Redis强制关闭出现快照不能持久化问题

今早打开网站发现无法访问了,页面出现了如下错误:

1
2
3
4
5
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.

第一次遇到这种情况,Google一波发现是由于前一天晚上强制关闭了redis-cli窗口导致redis快照无法持久化导致的,由于redis设置的是保存数据库快照,无法持久化到硬盘。根据网上的方法我们修改一下配置:

1
127.0.0.1:6379>config set stop-writes-on-bgsave-error no

即可解决问题.