REDIS-springboot向redis中写数据报错

时间:2022-05-11 06:40:52

springboot-redis报错如下:

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.

错误原因:
redis异常关闭,快照不能进行持久化

临时解决方案:
修改redis.conf中stop-writes-on-bgsave-error配置,设置为no

stop-writes-on-bgsave-error:
配置说明如下:
# By default Redis will stop accepting writes if RDB snapshots are enabled
# (at least one save point) and the latest background save failed.
# This will make the user aware (in a hard way) that data is not persisting
# on disk properly, otherwise chances are that no one will notice and some
# disaster will happen.
#
# If the background saving process will start working again Redis will
# automatically allow writes again.
#
# 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.

翻译:
# 默认情况下,如果 redis 最后一次的后台保存失败,redis 将停止接受写操作,
# 这样以一种强硬的方式让用户知道数据不能正确的持久化到磁盘,
# 否则就会没人注意到灾难的发生。
#
# 如果后台保存进程重新启动工作了,redis 也将自动的允许写操作。
#
# 然而你要是安装了靠谱的监控,你可能不希望 redis 这样做,那你就改成 no 好了。