当前位置: 首页> 教育> 高考 > 山西全网科技有限公司_东莞企业名录网_外链推广_百度指数的各项功能

山西全网科技有限公司_东莞企业名录网_外链推广_百度指数的各项功能

时间:2025/7/11 8:19:21来源:https://blog.csdn.net/chijiansong/article/details/146307508 浏览次数:1次
山西全网科技有限公司_东莞企业名录网_外链推广_百度指数的各项功能

org.springframework.data.redis.RedisSystemException: Redis exception; nested exception is io.lettuce.core.RedisException: io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection re
set by peer
at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:74)

添加配置

spring:

   redis:

      lettuce:

      pool:

        max-active: 8

        max-idle: 8

        min-idle: 2  # 保持最小空闲连接数

        max-wait: 1000ms

        time-between-eviction-runs: 30000  # 空闲连接检测周期(毫秒)

redisconfig配置增加

@Bean
public LettuceConnectionFactory redisConnectionFactory() {RedisStandaloneConfiguration serverConfig = new RedisStandaloneConfiguration(host, port);serverConfig.setPassword(password);LettuceClientConfiguration clientConfig = LettuceClientConfiguration.builder().commandTimeout(Duration.ofSeconds(5))  // 增加命令超时时间.shutdownTimeout(Duration.ofSeconds(2))  // 增加关闭超时时间.clientOptions(ClientOptions.builder().autoReconnect(true).disconnectedBehavior(ClientOptions.DisconnectedBehavior.REJECT_COMMANDS)  // 断开连接时拒绝命令.pingBeforeActivateConnection(true)  // 连接前PING测试.build()).build();LettuceConnectionFactory factory = new LettuceConnectionFactory(serverConfig, clientConfig);factory.setValidateConnection(true);  // 在工厂级别设置连接验证return factory;
}

关键字:山西全网科技有限公司_东莞企业名录网_外链推广_百度指数的各项功能

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: