Java R2DBC 连接被对等方重置

问题描述 投票:0回答:1

当外部用户调用 create 方法时,有时客户端会出现 Failed to acquire R2DBC Connection 错误。 原因:io.netty.channel.unix.Errors$NativeIoException:recvAddress(..)失败:连接被对等方重置 我的池配置:

  url: r2dbc:postgresql://PG_HOST:5432/credit-db
  username: PG_USER
  password: PG_PASSWORD
  pool:
    provider: fixed
    initial-size: 3
    min-idle: 3
    max-life-time: 600000
    max-size: 15
    connection-timeout: 30000
    pending-acquire-timeout: 60000
    evict-in-background: 120000
    idle-timeout: 20000
    acquire-retry: 3
    validation-query: SELECT 1
    register-mbeans: true
    validation:
      enabled: true
      validate-seconds: 60````

How to solve this problem

My dependency: 
<dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-data-r2dbc</artifactId>
      </dependency>
java spring-boot r2dbc r2dbc-pool socket-timeout
1个回答
-1
投票

服务器防火墙可能会限制空连接时间。

r2dbc:
...
  pool:
    ....
    max-idle-time: 5m`
© www.soinside.com 2019 - 2024. All rights reserved.