Redis报错信息

在Spring Boot中集成Redis客户之后,进行数据操作,发现报如下错误:

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.at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:54)at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:52)at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41)at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:44)at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:42)at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:270)at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.convertLettuceAccessException(LettuceStringCommands.java:799)at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.set(LettuceStringCommands.java:148)at org.springframework.data.redis.connection.DefaultedRedisConnection.set(DefaultedRedisConnection.java:281)at org.springframework.data.redis.core.DefaultValueOperations$3.inRedis(DefaultValueOperations.java:240)at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:60)at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:228)at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188)at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96)at org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:236)

报错原因

从Redis层面来分析错误的直接原因是:

Redis被配置为保存数据库快照,但它目前不能持久化到硬盘。用来修改集合数据的命令不能用。请查看Redis日志的详细错误信息。

也就是说,Redis无法将缓存中的数据写入本地磁盘。

针对Redis报错无法写入磁盘,往往有以下原因:

  • 磁盘满了
  • Redis配置问题
  • 操作权限问题

如果磁盘满了,直接清理磁盘或进行扩充即可。

解决方案

问题一

如果是权限问题,查看日志会发现如下日志:

11875:M 06 Mar 2020 09:00:12.034 * 1 changes in 3600 seconds. Saving...
11875:M 06 Mar 2020 09:00:12.035 * Background saving started by pid 12625
12625:C 06 Mar 2020 09:00:12.036 # Failed opening the RDB file dump.rdb (in server root dir /usr/local/redis-5.0.7) for saving: Permission denied

如果是权限问题,则服务对应目录的权限,或在配置文件中修改目标目录到有权限操作的目录。

默认目录配置如下:

# The filename where to dump the DB
dbfilename dump.rdb# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir ./

修改下面的dir路径:

dir /Users/zzs/tools/dbs

然后重启即可。在重启的过程中可能依然由于无法保存数据而死循环,此时就需要杀手锏了。

问题二

如果是配置问题导致,则可进行如下修改。

使用redis-cli连接上redis,然后执行如下命令:

config set stop-writes-on-bgsave-error no

通过将stop-writes-on-bgsave-error设置为no来进行解决。但这种方案治标不治本,从根本上来讲,还是需要大家查看后台异常原因,进行有针对性的解决。

原文链接:《解决Redis报错Redis is configured to save RDB snapshots, but it is currently not able to persist on disk.》

精品SpringBoot 2.x视频教程

《Spring Boot 2.x 视频教程全家桶》,精品Spring Boot 2.x视频教程,打造一套最全的Spring Boot 2.x视频教程。


程序新视界
公众号“程序新视界”,一个让你软实力、硬技术同步提升的平台

解决Redis报错Redis is configured to save RDB snapshots, but it is currently not able to persist on disk相关推荐

  1. 解决redis报错:Redis is configured to save RDB snapshots, but it is currently not able to persist on disk

    1.问题描述 操作redis时,提示:Redis is configured to save RDB snapshots, but it is currently not able to persis ...

  2. 解决MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk

    1.起因 使用jeecgboot验证码登陆后台时,一直报验证码错误,看控制台发现是redis报错了,具体如下: Error in execution; nested exception is io.l ...

  3. MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk.

    MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. ...

  4. Redis Is Configured To Save RDB Snapshots, But It Is Currently Not Able To Persist On Disk.

    从Redis层面来分析错误的直接原因是: 我们在Redis配置中设置了保存数据库快照,但是当前redis持久化到磁盘失败. 可能有以下情况 情况一: redis使用的磁盘容量满了 解决方法:使用 df ...

  5. redis报错解决,MISCONF Redis is configured to save RDB snapshots

    报错记录 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on d ...

  6. Redis - MISCONF Redis is configured to save RDB snapshots 报RDB快照错误

    完整的报错信息: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MIS ...

  7. 解决redis连接错误:MISCONF Redis is configured to save RDB snapshots, but it is currently not able to...

    今天重启游戏服务器在连接redis数据库时突然报错:MISCONF Redis is configured to save RDB snapshots, but it is currently not ...

  8. 解决redis连接错误:MISCONF Redis is configured to save RDB snapshots

    今天Redis服务器在连接redis数据库时突然报错:MISCONF Redis is configured to save RDB snapshots, but it is currently no ...

  9. Redis_保存数据时报错MISCONF Redis is configured to save RDB snapshots, but it is curren

    Redis_保存数据时报错MISCONF Redis is configured to save RDB snapshots, but it is currently not able to pers ...

最新文章

  1. 网页失去焦点事件 visibilitychange
  2. 在制造业大厂当程序员是什么感受?
  3. inrange函数_Python 初学者必备的常用内置函数
  4. EHCache 初步使用指南
  5. 做技术,未来出路在哪?
  6. 备份有困难?Oracle DBA详述RMAN备份
  7. MYSQL 源代码编绎脚本
  8. 养老金8000元左右,身体好,无负担,怎样安排退休生活好呢?
  9. 真我手机信号好还是苹果三星信号好?
  10. 记某次“静态浮动路由+urpf导致”网络故障排查
  11. 09年最好看的电影大全_09年最经典的电影大全
  12. 怎么设置计算机桌面一键关机,图文详解如何设置电脑定时开关机
  13. 鸿蒙时期电视剧,《我的时代,你的时代》|电视剧简介
  14. 艾司博讯:拼多多判断正品的标准是什么
  15. 【HDL系列】乘法器(5)——Radix-2 Booth乘法器
  16. Java8 StreamFilter
  17. WAS 6.1 的类加载
  18. Nodejs编程(2)
  19. 开源架构Fabric、FISCO BCOS(以下简称“BCOS”)、CITA 技术对比
  20. docker部署命令

热门文章

  1. 当运行【gpedit.msc】命令想要打开【本地组策略编辑器】时,却提示找不到
  2. 卷积神经网络CNN(7)—— 限速交通标志分类
  3. 4. 分布式系统中的同步
  4. Oracle项目管理系统之会议闭环管理
  5. Mysql : 对于表数据处理增删改的内容上的打字练习
  6. 深度学习机器臂控制_基于深度强化学习的机器人手臂控制
  7. webpack 5 模块联邦实现微前端疑难问题解决
  8. jQuery实现模拟淘宝精品
  9. 明翰英语教学系列之时态与语态篇
  10. 推导光的多普勒效应公式·比航专ppt更符合直觉