今天突然发现应用报错:

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 配置了将数据保存到磁盘,但目前无法保存,所以无法执行命令,且由于实例配置了报错,所以出现了这个。

想起来昨天我执行了 homebrew 更新命令,可能更新了 Redis 导致的。

解决办法:

根据提示打开 Redis 的配置文件:

vim /opt/homebrew/etc/redis.conf 

搜索 stop-writes-on-bgsave-error,找到:

 444 # However if you have setup your proper monitoring of the Redis server
 445 # and persistence, you may want to disable this feature so that Redis will
 446 # continue to work as usual even if there are problems with disk,
 447 # permissions, and so forth.
 448 stop-writes-on-bgsave-error yes

yes 改为 no,然后重启 reids:

brew service restart nginx

问题解决。

标签: macos, redis