1. 程式人生 > >解決強制把redis快照關閉了導致不能持久化的問題

解決強制把redis快照關閉了導致不能持久化的問題

在用Python與Redis互動時,設定資料出現下列報錯資訊:

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快照關閉了導致不能持久化的問題。

解決方法:

方法1、在連線了命令列輸入:

redis-cli

再輸入這句就可以解決:

config set stop-writes-on-bgsave-error no

方法2、修改redis.conf檔案:

vim開啟redis-server配置的redis.conf檔案,然後使用快捷匹配模式:/stop-writes-on-bgsave-error定位到stop-writes-on-bgsave-error字串所在位置,接著把後面的yes設定為no即可。