(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-cli 127.0.0.1:6379> config set stop-writes-on-bgsave-error no OK 127.0.0.1:6379> set name neo OK 127.0.0.1:6379> get name "neo"
原因是資料庫持久化寫入硬碟出現問題,可能是資料庫目錄權限不足。
排查方法
CONFIG GET dir CONFIG GET dbfilename config set stop-writes-on-bgsave-error yes CONFIG SET dir /tmp CONFIG SET dbfilename temp.rdb
嘗試解決
# redis-cli 127.0.0.1:6379> CONFIG GET dir 1) "dir" 2) "/" 127.0.0.1:6379> CONFIG GET dbfilename 1) "dbfilename" 2) "dump.rdb" 127.0.0.1:6379> config set stop-writes-on-bgsave-error yes OK 127.0.0.1:6379> CONFIG SET dir /tmp OK 127.0.0.1:6379> set test aaaa OK 127.0.0.1:6379> get test "aaaa"
如果確認是 dir 權限問題,我們就通過修改redis.conf 中得dir配置解決。