SpringBoot Hikari连接池-数据库连接丢失(丢失)并获取jdbc连接错误

时间:2020-07-23 09:32:41

标签: spring spring-boot spring-mvc spring-data-jpa spring-data

我正在使用带有Hikari的Spring Boot,请在下面找到连接详细信息。 当应用程序运行时。连接耗尽并变为零

    spring.datasource.username=test
    spring.datasource.password=test
    spring.datasource.hikari.maximum-pool-size = 100
    spring.datasource.hikari.idleTimeout=180000
    spring.datasource.hikari.maxLifetime=300000
    spring.datasource.hikari.minimum-idle= 10

当应用程序运行时,连接池减少并变为零,我们得到数据库异常。

在下面找到日志。

 UT 2020-07-23 16:52:23.420 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    om.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=0, active=0, 
    idle=0, waiting=2)
    
    OUT 2020-07-23 16:51:53.419 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=2, active=0, 
    idle=2, waiting=0)
    
    OUT 2020-07-23 16:51:23.418 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=4, active=1, 
    idle=3, waiting=0)
    
    OUT 2020-07-23 16:50:53.418 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    om.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats 
    (total=4, active=0, 
    idle=4, waiting=0)
    
    OUT 2020-07-23 16:50:23.417 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper]     
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats 
    (total=4, active=0,       idle=4, 
    waiting=0)
    Thu, Jul 23, 2020 16:49:53.417
    [APP/PROC/WEB/0]
    OUT 2020-07-23 16:49:53.416 DEBUG [Test-service,,,] 13 --- [HikariPool-1 
    sekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=4, active=0,     id le=4, waiting=0)
     Thu, Jul 23, 2020 16:49:23.416
    [APP/PROC/WEB/0]
    OUT 2020-07-23 16:49:23.416 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=4, active=0,   idle=4, waiting=0)
    Thu, Jul 23, 2020 16:48:53.416
    [APP/PROC/WEB/0]
    OUT 2020-07-23 16:48:53.415 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=5, active=0,     idle=5, waiting=0)
    Thu, Jul 23, 2020 16:48:23.415
    [APP/PROC/WEB/0]
    OUT 2020-07-23 16:48:23.415 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=5, active=0,     idle=5, waiting=0)
    Thu, Jul 23, 2020 16:47:53.413
    APP/PROC/WEB/0]
    OUT 2020-07-23 16:47:53.412 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=5, active=0, idle=5, waiting=0)
    Thu, Jul 23, 2020 16:47:23.411
    [APP/PROC/WEB/0]
    OUT 2020-07-23 16:47:23.410 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=5, active=0,    idle=5, waiting=0)
    Thu, Jul 23, 2020 16:46:53.410
    [ APP/PROC/WEB/0]
    OUT 2020-07-23 16:46:53.410 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats 
    (total=10, active=0,    idle=10, waiting=0)
    Thu, Jul 23, 2020 16:46:23.409
    [APP/PROC/WEB/0]
    OUT 2020-07-23 16:46:23.408 DEBUG [Test-service,,,] 13 --- [HikariPool-1 housekeeper] 
    com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before cleanup stats (total=10, active=0,     idle=10, waiting=0)

1 个答案:

答案 0 :(得分:0)

检查后,发现某些网络异常导致了此问题。

连接重置异常和套接字被远程主机关闭。

能够在网络团队解决此问题后进行解决。