服务器意外重启后项目链接redis报错

redis.exceptions.ResponseError: MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to 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配置为保存RDB快照,但目前无法在磁盘上持久化。可能修改数据集的命令被禁用,因为此实例配置为在RDB快照失败时报告写入期间的错误。
解决方法如下
(1)设置 stop-writes-on-bgsave-error值为no即可避免这种问题。(测试可用)

// 登录
redis-cli -h 127.0.0.1 -p 6379
auth '你的密码'
127.0.0.1:6379> config set stop-writes-on-bgsave-error no

(2)[微测试]
直接修改redis.conf配置文件,修改后需要重启redis。
(1)vim打开redis-server配置的redis.conf文件,
(2)找到stop-writes-on-bgsave-error字符串所在位置,
(3)把后面的yes设置为no。

转自:https://www.jianshu.com/p/bce2d01d9772

上一篇 下一篇