redis持久化问题处理
这个是最近在开发的过程中遇到的问题,因为需要频繁使用redis作为中间查询操作,突然故障了,服务中止,然后抛出异常
2020-01-09 09:34:17.848 ERROR 25703 --- [ XNIO-2 task-83] o.z.p.spring.web.advice.AdviceTrait : Internal Server Error org.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
- 修改快照备份的目录,即将快照重定向到其他目录
- 修改主机内存配置
解决方案1
将stop-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/var CONFIG SET dbfilename temp.rdb
使用这个命令之后,需要确保bgsave_in_progress
返回结果是0
解决方案3
在内核运行时动态地修改内核的运行参数
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf sysctl vm.overcommit_memory=1
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
2020年十大网络安全预测
当审视2020年网络安全预测时,我们会看到好消息和坏消息。首先,坏消息是:现有威胁将进一步恶化,并且将出现全新威胁。 好消息呢?在可预见的将来,网络安全专业人员的饭碗不会丢。尽管AI、机器学习和自动化技术不断发展,人类仍将继续成为企业网络安全的第一道防线。这些工具可帮助人类,但不能替代人类的直觉和洞察力。 以下是笔者对2020年的网络安全的预测,以及建议采取的措施。 预测#1:民族国家威胁 民族国家活动将对企业组织构成更大的威胁。据称,一月份美国无人机击毙索莱马尼将军,伊朗立即采取的行动是发起网络攻击。同样值得注意的是,也许不是很明显,就是这种假设的攻击可能不是专门针对政府基础设施。企业组织也面临风险,尤其是那些与目标国家/地区紧密关联的知名度较高的组织。例如,显然可能针对美国公司,例如美国航空、麦当劳、可口可乐和星巴克。2014年对索尼的攻击(普遍归因于朝鲜政府)就是征兆。 建议采取的措施:企业应制定并执行明确针对民族国家行为者的网络安全策略。 预测#2:DoS攻击继续盛行 所有类型的拒绝服务(DoS)攻击都会增加。有些企业网络安全专业人员认为,DoS攻击可能会专门针对基础设施组件,...
- 下一篇
Docker私有仓库部署---Harbor(实例演示!!!)
Harbor概述 Harbor是VMware公司开源的企业级Docker Registry项目 Harbor的优势 基于角色控制 基于镜像的复制策略 支持LDAP/AD 图像删除和垃圾收集 图形UI 审计 RESTful API Harbor架构组成 Proxy 通过一个前置的反向代理统一接受浏览器,Docker客户端的请求,并将请求转发给后端不同的服务 Registry 负责存储Docker镜像。并处理docker push/pull 命令 Core services Harbor的核心功能,包括UI、webhook、token服务 UI:提供网络页面 token:令牌 Webhook:微服务中的回调机制 Database 为core services提供数据库服务 Log collector 负责收集其他组件的log,供日后进行分析 Docker私有仓库架构拓扑: 用户请求通过Proxy反向代理访问Core services,UI提供web界面,token令牌,你第一次登录之后服务器会给你一串序列号,下次直接登录就行,你需要下载的镜像信息,属性,都存放在后面的database,再通...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- Red5直播服务器,属于Java语言的直播服务器
- Docker使用Oracle官方镜像安装(12C,18C,19C)
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- Docker安装Oracle12C,快速搭建Oracle学习环境
- CentOS6,CentOS7官方镜像安装Oracle11G
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- CentOS关闭SELinux安全模块
- CentOS7编译安装Gcc9.2.0,解决mysql等软件编译问题
- Windows10,CentOS7,CentOS8安装MongoDB4.0.16
- Hadoop3单机部署,实现最简伪集群