如何修复错误 "(error) MISCONF Redis 配置为保存 RDB 快照"?
上次更新时间 2024 年 3 月 22 日
问题
每当我尝试写入新键时,Redis OSS 中的默认配置都会导致此错误。如何解决此问题?
127.0.0.1:6379> sadd mykey:name john1
(error) 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.
答案
持久化到磁盘时出现问题。虽然此类错误必须在系统级别进行故障排除,但实现写入操作并使其发生的权宜之计是在配置中或在运行时设置以下配置以允许写入。
config set stop-writes-on-bgsave-error no
参考
查看 Redis 配置文件中的文档,了解您的 Redis 服务器版本,您可以在其中找到解释
# However if you have setup your proper monitoring of the Redis server
# and persistence, you may want to disable this feature so that Redis will
# continue to work as usual even if there are problems with disk,
# permissions, and so forth.