一、报错概述
1.1、报错
org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: 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.
1.2、报错原因
我检查了Redis服务已经启动,但还是继续报这个错误,查了之后才知道原因,是因为强制把Redis快照关闭了导致不能持久化的问题,通过stop-writes-on-bgsave-error值设置为no即可避免这种问题。
二、解决方法
2.1、命令行修改
在redis安装的目录下,启动客户端./redis-cli,输入命令config set stop-writes-on-bgsave-error no,回车即可;
2.2、配置文件修改
打开redis-server的配置文件redis.conf,使用快捷匹配模式:/stop-writes-on-bgsave-error,找到stop-writes-on-bgsave-error字符串所在位置,把后面的yes设置为no,记得要保存,命令wq! 保存退出。