Redis exception; nested exception is io.lettuce.core.RedisException java.io.IOException 远程主机

这篇具有很好参考价值的文章主要介绍了Redis exception; nested exception is io.lettuce.core.RedisException java.io.IOException 远程主机。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

个人解决方法:
编辑/etc/ssh/sshd_config,添加配置项:

ClientAliveInterval 600      
ClientAliveCountMax 10

配置完后保存,重启服务:

service sshd restart

以下是整个经过:

本地开发是发现隔一段时间没请求redis就会报错:

2020/07/09 10:31:35 ERROR [com.SpringLearn.common.redis.JedisUtils] - Redis exception; nested exception is io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。
org.springframework.data.redis.RedisSystemException: Redis exception; nested exception is io.lettuce.core.RedisException: java.io.IOException: 远程主机强迫关闭了一个现有的连接。
 at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:74)
 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:268)
 at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.convertLettuceAccessException(LettuceStringCommands.java:799)
 at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java:68)
 at org.springframework.data.redis.connection.DefaultedRedisConnection.get(DefaultedRedisConnection.java:253)
 at org.springframework.data.redis.core.DefaultValueOperations$1.inRedis(DefaultValueOperations.java:57)
 at org.springframework.data.redis.core.AbstractOperations$ValueDeserializingRedisCallback.doInRedis(AbstractOperations.java:59)
 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.DefaultValueOperations.get(DefaultValueOperations.java:53)
 at com.SpringLearn.common.redis.JedisUtils.get(JedisUtils.java:114)
 at com.SpringLearn.common.framework.securi

网上看了很多解决办法,都是timeout和tcp-keepalive的配置,多次试验后都无效,最奇怪的是putty链接服务器也是过一会就断开了,mysql出现了这种情况,于是猜测不是redis的配置问题,开启本地虚拟机测试发现没有出现断开链接的问题,查了putty自动断开链接的解决方案(文章开头),修改完后上面的问题竟然解决了,本地服务的输出日志出现了下面的日志:

2020/07/09 20:20:02 INFO  [io.lettuce.core.protocol.ConnectionWatchdog] - Reconnecting, last destination was /139.xxx.xx.xx:6666
2020/07/09 20:20:03 INFO  [io.lettuce.core.protocol.ReconnectionHandler] - Reconnected to 139.xxx.xx.xx:6666
2020/07/09 20:20:03 INFO  [io.lettuce.core.protocol.ConnectionWatchdog] - Reconnecting, last destination was /139.xxx.xxx.xx:6666
2020/07/09 20:20:03 INFO  [io.lettuce.core.protocol.ReconnectionHandler] - Reconnected to 139.xxx.xxx.xxx:6666

可以看出连接池每隔一段时间在重新链接到redis,不知道什么原因,希望有大佬解答 Thanks(?ω?)?文章来源地址https://www.toymoban.com/news/detail-660716.html

到了这里,关于Redis exception; nested exception is io.lettuce.core.RedisException java.io.IOException 远程主机的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • 已解决 nested exception is java.lang.StackOverflowError

    已解决 nested exception is java.lang.StackOverflowError nested exception is java.lang.StackOverflowError 对于错误消息\\\"nested exception is java.lang.StackOverflowError\\\",通常表示程序递归调用过多,导致栈溢出。 下滑查看解决方法 下面是一些可能的解决方法: 检查递归方法:检查代码中是否存在无限递归

    2024年02月05日
    浏览(9)
  • 【Springboot整合Redis已解决】 Unable to connect to Redis; nested exception is org.springframework.data.redi

    介绍 这里是小编成长之路的历程,也是小编的学习之路。希望和各位大佬们一起成长! 以下为小编最喜欢的两句话: 要有最朴素的生活和最遥远的梦想,即使明天天寒地冻,山高水远,路远马亡。 一个人为什么要努力? 我见过最好的答案就是:因为我喜欢的东西都很贵,

    2024年02月15日
    浏览(10)
  • nested exception is java.sql.SQLException: connection disabled

    在使用Spring Boot连接数据库时,有时候会遇到\\\"nested exception is java.sql.SQLException: connection disabled\\\"异常。这个异常通常是由以下原因引起的: 数据库连接配置错误:检查数据库连接的URL、用户名和密码是否正确配置。确保URL中包含正确的数据库名称,并且用户名和密码与数据库中

    2024年02月12日
    浏览(11)
  • 【已解决】Factory method ‘redisConnectionFactory‘ threw exception; nested exception is java.lang.

    Factory method ‘redisConnectionFactory’ threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool2/impl/GenericObjectPoolConfig springboot整合redis报错 缺少对应依赖文件加上即可

    2024年02月06日
    浏览(7)
  • Handler dispatch failed; nested exception is java.lang.StackOverflowError

    错误原因代码:  检查发现在service层调用service,出现错误,因此改为调用mapper层即可。 更改后: 更改项目代码后,重新运行代码,即可正常运行。

    2024年02月09日
    浏览(13)
  • 已解决:Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException:

    已解决:Unexpected exception during bean creation; nested exception is java.lang.IllegalStateException:

    这个异常通常是由于在使用 Spring Cloud Feign 客户端进行负载均衡时缺少相关的依赖引起的。具体来说,它提示你忘记在项目的依赖中包含  spring-cloud-starter-loadbalancer 。 spring-cloud-starter-loadbalancer  是用于支持负载均衡功能的 Spring Cloud Starter 组件之一。它提供了负责将请求分发

    2024年02月08日
    浏览(12)
  • Handler dispatch failed; nested exception is java.lang.StackOverflowError 错误

    遇见内存溢出问题—jvm ` 提示:StackOverflowError栈内存溢出 StackOverflowError 是一个java中常出现的错误:在jvm运行时的数据区域中有一个java虚拟机栈,当执行java方法时会进行压栈弹栈的操作。在栈中会保存局部变量,操作数栈,方法出口等等。jvm规定了栈的最大深度,当执行时

    2024年02月15日
    浏览(9)
  • SpringBoot项目调用openCV报错:nested exception is java.lang.UnsatisfiedLinkError

    SpringBoot项目调用openCV报错:nested exception is java.lang.UnsatisfiedLinkError

    今天在通过web项目调用openCV的时候提示如下错误: 如下图所示: 但是通过直接启动java main函数确正常,初步诊断和SpringBoot热加载有关,遂将pom中如下配置注释掉: 重新启动web项目,异常排除。

    2024年01月16日
    浏览(13)
  • Maximum upload size exceeded; nested exception is java.lang.IllegalStateException解决办法

    一、问题描述 Springboot文件上传时报错:org.springframework.web.multipart.MaxUploadSizeExceededException: Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException: The field fileUrl exceeds its maximum permitted size of 10485760 bytes. 完整报错

    2024年02月11日
    浏览(12)
  • Injection of autowired dependencies failed; nested exception is java.lang.Il

    ​ 今天在学习nacos统一配置管理时,使用了@value注解,用来注入nacos中的配置属性,发现读取不到,代码如下: 启动服务时发现报以下错误: 经过多方面检查,发现是环境问题,我bootstrap.yml中写给我的统一配置管理配置的是dev开发环境,配置如下: 而我的服务没有配置为开发环

    2024年02月07日
    浏览(10)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包