programing

Spring Boot/JDBI/MySQL 응용 프로그램에서 HikariCP를 구성할 수 없습니다.

kingscode 2022. 10. 10. 22:21
반응형

Spring Boot/JDBI/MySQL 응용 프로그램에서 HikariCP를 구성할 수 없습니다.

MariaDB 호스트 데이터베이스에 대한 RESTful 인터페이스를 구축하고 있는데 서버가 잠시 아이돌 상태가 된 후에도 데이터베이스 연결이 타임아웃되지 않도록 HikariCP를 적절하게 구성하는 방법을 알 수 없습니다.

Linux, Java 1.8을 사용하고 있으며 데이터베이스 서버는 MariaDB 5.5.60입니다.응용 프로그램에서는 다음 기술 스택을 사용합니다.

  • spring-boot-boot-jdbc: 2.0.1
  • spring-boot-data-rest: 2.0.1
  • jdbi3-core: 3.1.0
  • jdbi3-blobject: 3.1.0
  • mysql-sysql-sysql: 5.1.46
  • HikariCP : 2.7.8 (스프링 경유로 암시 제공)

현재 application.properties 파일은 다음과 같습니다.

   spring.datasource.url=jdbc:mysql://localhost/my_database
   spring.datasource.username=myusername
   spring.datasource.password=myp@ssw0rd
   spring.datasource.driver-class-name=com.mysql.jdbc.Driver
   # 15 min * 60 sec * 1000 ms = 900000
   spring.datasource.hikari.maxLifetime=900000

max Life time 값이 무시되고 있습니다.이 파일(여기 SO에서 많이 볼 수 있는)에서 히카리와 관련된 모든 것을 시도해 보았습니다만, 어느 것도 효과가 없는 것 같습니다.서버가 밤새 아이돌 상태일 때 다음 경고가 나타납니다.

com.zaxxer.hikari.pool.ProxyConnection: HikariPool-1 - Connection com.mysql.jdbc.JDBC4Connection@140ae1bb marked as broken because of SQLSTATE(08S01) ,ErrorCode(0)
com.mysql.jdbc.exception.jdb4.CommunicationsException: The last packet successfully received from the server was 422,968,077 milliseconds ago. The last packet sent successfully to the server was 422,968,086 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

...그리고 오류 더미와 흔적을 쌓아서 널 살려주마.

제 직감으로는 application.properties 파일에 마법의 파라미터 조합이 없는 것 같습니다만, 저는 어찌할 바를 모르겠습니다.또, 하룻밤을 기다리지 않고 실제로 동작하고 있는 것을 확인하는 방법도 곤란합니다.

어떤 도움이라도 감사합니다!

언급URL : https://stackoverflow.com/questions/55712462/unable-to-configure-hikaricp-in-spring-boot-jdbi-mysql-application

반응형