org.springframework.data.redis.RedisSystemException: Redis exception; nested exception is io.lettuce...

程序出现Redis连接错误,报RedisException和IOException,原因是Redis默认快照未开启导致连接不持久。解决方案是将stop-writes-on-bgsave-error设置为no,可以通过命令行或修改redis.conf文件实现。

springBoot + redis. 程序隔一段时间会莫名其妙的报Redis的错误. 报错如下:

org.springframework.data.redis.RedisSystemException: Redis exception; nested exception is io.lettuce.core.RedisException: java.io.IOException: Connection reset by peer

百度得知说: 是因为redis默认快照是关闭的, 导致了Redis连接不能持久化,通过stop-writes-on-bgsave-error值设置为no 可避免这种问题。

有两种设置方式:

通过命令修改的方式:
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
1
修改redis.conf文件
vim或者vi 编辑redis.conf, 找到stop-writes-on-bgsave-error配置设置为no即可.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值