22-异常-io.lettuce.core.RedisCommandExecutionException MISCONF Redis is configured to save RDB snapsho

更多内容欢迎关注我(持续更新中,欢迎Star✨)

Github:CodeZeng1998/Java-Developer-Work-Note

(技术)微信公众号:CodeZeng1998

(生活)微信公众号:好锅

其他平台:CodeZeng1998好锅


问题描述

​ 今天监测系统突然告警,Kafka消费消息部分失败数大幅度提高,然后就去排查了下,具体的内容可查看下面报错信息。


报错信息:

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) ~[spring-data-redis-2.2.1.RELEASE.jar:2.2.1.RELEASE]
	at java.lang.Thread.run(Thread.java:750) [?:1.8.0_333]
Caused by: 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 io.lettuce.core.ExceptionFactory.createExecutionException(ExceptionFactory.java:135) ~[lettuce-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]
	at io.lettuce.core.ExceptionFactory.createExecutionException(ExceptionFactory.java:108) ~[lettuce-core-5.2.1.RELEASE.jar:5.2.1.RELEASE]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) ~[netty-transport-4.1.43.Final.jar:4.1.43.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) ~[netty-transport-4.1.43.Final.jar:4.1.43.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050) ~[netty-common-4.1.43.Final.jar:4.1.43.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.43.Final.jar:4.1.43.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(Fast

错误原因

​ 这个错误与 Redis 的持久化功能(RDB 快照)出现的问题有关。具体地,Redis 无法将 RDB 快照保存到磁盘,因此阻止了任何可能修改数据集的写操作。我这里导致的错误的原因是因为 Redis 服务所在的服务器没有对应的磁盘空间了。


解决方案

  1. 检查磁盘空间和权限

    • 检查 Redis 服务器所在磁盘的剩余空间,确保有足够的空间来保存 RDB 文件。
    • 确认 Redis 进程对保存 RDB 文件的目录具有写入权限。
  2. 检查 Redis 配置

    • 查看 Redis 配置文件(通常是 redis.conf)中的 dirdbfilename 配置项,确保它们指向有效的路径。

    • 如果你不需要 RDB 快照持久化功能,可以暂时禁用它:

      save ""
      

      这会停止 RDB 持久化功能,但注意这意味着 Redis 不会保存数据到磁盘。

  3. 日志分析

    • 查看 Redis 日志文件,获取更多关于 RDB 保存失败的详细信息。日志文件通常会说明为什么 Redis 无法保存快照。
  4. 调整 Redis 配置

    • 如果你希望继续使用 RDB 快照功能,但不希望因保存失败而停止写操作,可以在 Redis 配置文件中修改以下配置:

      stop-writes-on-bgsave-error no
      

      这会允许即使 RDB 快照失败,Redis 仍然可以继续接受写入操作,但这可能会增加数据丢失的风险。

  5. Redis 重启

    • 在修复了上述问题后,尝试重启 Redis 服务器,观察是否可以恢复正常操作。

这些步骤应该能够帮助你解决 Redis 持久化失败的问题。如果在进行这些操作后问题依然存在,建议深入分析 Redis 日志以获得更多线索。

在这里插入图片描述

上图是由 Pic 生成的

关键词:A man in a suit with a handgun in his head pointing it at himself


更多内容欢迎关注我(持续更新中,欢迎Star✨)

Github:CodeZeng1998/Java-Developer-Work-Note

(技术)微信公众号:CodeZeng1998

(生活)微信公众号:好锅

其他平台:CodeZeng1998好锅

  • 16
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值