首先找到出現錯誤的原因:
redis.exceptions.ResponseError: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk.
Commands that may modify the data set are disabled.
Please check Redis logs for details about the error.
misconf redis被配置以保存數據庫快照,但misconf redis目前不能在硬盤上持久化。用來修改數據集合的命令不能用,請使用日志的錯誤詳細信息。
強制把redis快照關閉了導致不能持久化的問題。運行info命令查看redis快照的狀態,如下:
解決方案如下:
1. redis運行 config set stop-writes-on-bgsave-error no 命令
config set stop-writes-on-bgsave-error no
2.修改redis.conf文件:vi打開redis-server配置的redis.conf文件,然后定位到stop-writes-on-bgsave-error字符串所在位置,接着把后面的yes設置為no即可。
stop-writes-on-bgsave-error no