问题描述
我有一个使用 spring cloud bom 的 spring boot 应用程序:Hoxton.SR1
应用部署在 kubernetes 集群中。
为了将应用程序连接到 redis 数据库,我测试了 2 种不同的配置:
- Jedis 连接池配置:
pom.xml
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- jedis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
application.yml
:
spring:
redis:
host: localhost
port: 6379
password: password
database: 0
jedis:
pool:
min-idle: 0
max-idle: 12
max-active: 12
max-wait: 500ms
在 K8S 集群中部署效果很好。
- 生菜连接池配置:
pom.xml
:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--lettuce connection pool-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
application.yml
:
spring:
redis:
host: localhost
port: 6379
password: password
database: 0
lettuce:
pool:
min-idle: 0
max-idle: 12
max-active: 12
max-wait: 500ms
在 K8S 集群中部署不起作用,错误是:Liveness probe Failed: Get http://10.68.13.246:8080/actuator/health: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
。
我错过了什么? 这可能是什么根本原因? 是否与弹簧执行器或生菜接头有关?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)