主机论坛_虚拟主机_美国主机_美国虚拟主机_云主机技术_全球主机交流聚集地—Web Hosting Talk 中文站

找回密码
立即注册
发新帖

0

收听

5

听众

1015

主题
发表于 2022-1-24 16:43:45 | 查看: 207| 回复: 0
这个是最近在开发的过程中遇到的问题,因为需要频繁使用redis作为中间查询操作,突然故障了,服务中止,然后抛出异常
2020-01-09 09:34:17.848 ERROR 25703 --- [ XNIO-2 task-83] o.z.p.spring.web.advice.AdviceTrait      : Internal Server Errororg.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: 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.    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:257)    at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.convertLettuceAccessException(LettuceHashCommands.java:445)    at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.hSet(LettuceHashCommands.java:70)    at org.springframework.data.redis.connection.DefaultedRedisConnection.hSet(DefaultedRedisConnection.java:827)    at org.springframework.data.redis.connection.DefaultStringRedisConnection.hSet(DefaultStringRedisConnection.java:501)    at org.springframework.data.redis.core.DefaultHashOperations.lambda$put$8(DefaultHashOperations.java:178)    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:224)    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:184)    at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:95)    at org.springframework.data.redis.core.DefaultHashOperations.put(DefaultHashOperations.java:177)    at com.smpteam.aaaa.service.impl.RedisServiceImpl.setESSession(RedisServiceImpl.java:59)    at com.smpteam.aaaa.service.impl.RedisServiceImpl$$FastClassBySpringCGLIB$$11b51629.invoke(<generated>)    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)    . . .Caused by: io.lettuce.core.RedisCommandExecutionException: 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-cli登录redis服务器检查情况,发现ping不通

(error) 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问题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日志的详细错误信息。
原因强制关闭Redis快照导致不能持久化。本质上是内存不足导致的。因此需要进行相关的内存处理:
修改redis config修改快照备份的目录,即将快照重定向到其他目录修改主机内存配置解决方案1stop-writes-on-bgsave-error设置为no,这个方式是直接关闭保存持久化快照
127.0.0.1:6379> config set stop-writes-on-bgsave-error no这个在生产中可能会出现一些问题,这个然而这个方法治标不治本,他只是让我们忽略他而已,使用之前需要确认bgsave失败的原因,比如当redis用于缓存、会话的场景的时候,这么做是允许的

解决方案2将备份的rdb文件,重定向到目录
CONFIG SET dir /tmp/some/directory/other/than/varCONFIG SET dbfilename temp.rdb使用这个命令之后,需要确保bgsave_in_progress返回结果是0
解决方案3在内核运行时动态地修改内核的运行参数
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.confsysctl vm.overcommit_memory=1

SD-WAN-MPLS组网http://www.kd010.com/

收藏回复 显示全部楼层 道具 举报

您需要登录后才可以回帖 登录 | 立即注册

Archiver|手机版|小黑屋|WebHostingTalk中文站

GMT+8, 2024-4-29 09:57 , Processed in 0.078998 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表