반응형
짧은 maxLifetime 값 - hikari 연결 풀 스프링 부트 사용을 고려해 보십시오.
Spring Boot 응용 프로그램을 실행한 후 서버 시작 몇 분 만에 예외가 발생합니다.외부에서 HikariPool 구성을 사용하지 않음Spring Boot은 기본적으로 HikariPool을 사용합니다.이것은 콘솔에 표시되는 오류입니다.
2020-02-20 03:16:23 - HikariPool-4 - Failed to validate connection
com.mysql.cj.jdbc.ConnectionImpl@4c4180c8 (No operations allowed after connection closed.).
Possibly consider using a shorter maxLifetime value.
2020-02-20 03:16:28 - HikariPool-4 - Failed to validate connection
com.mysql.cj.jdbc.ConnectionImpl@679c2f50 (No operations allowed after connection closed.).
Possibly consider using a shorter maxLifetime value.
2020-02-20 03:16:33 - HikariPool-4 - Failed to validate connection
com.mysql.cj.jdbc.ConnectionImpl@16083061 (No operations allowed after connection closed.).
Possibly consider using a shorter maxLifetime value.
2020-02-20 03:16:38 - HikariPool-4 - Failed to validate connection
com.mysql.cj.jdbc.ConnectionImpl@4fcaf421 (No operations allowed after connection closed.).
Possibly consider using a shorter maxLifetime value.
2020-02-20 03:16:43 - HikariPool-4 - Failed to validate connection
com.mysql.cj.jdbc.ConnectionImpl@33df5d54 (No operations allowed after connection closed.).
Possibly consider using a shorter maxLifetime value.
2020-02-20 03:16:48 - HikariPool-4 - Failed to validate connection
com.mysql.cj.jdbc.ConnectionImpl@373d288c (No operations allowed after connection closed.).
Possibly consider using a shorter maxLifetime value.
2020-02-20 03:16:48 - SQL Error: 0, SQLState: 08003
2020-02-20 03:16:48 - HikariPool-4 - Connection is not available, request timed out after
30156ms.
2020-02-20 03:16:48 - No operations allowed after connection closed.
2020-02-20 03:16:48 - Servlet.service() for servlet [dispatcherServlet] in context with path
[] threw exception [Request processing failed; nested exception is
org.springframework.dao.DataAccessResourceFailureException: Unable to acquire JDBC
Connection; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to
acquire JDBC Connection] with root cause
문제는 의 디폴트값이spring.datasource.hikari.maxLifetime
속성(기본값 30분, https://github.com/brettwooldridge/HikariCP#gear-configuration-knobs-baby)은 데이터베이스보다 높음)wait_timeout
제 경우엔 10분입니다.
두 가지 옵션을 선택할 수 있습니다.hikari.maxLifetime
10분 미만 또는 데이터베이스 증가wait_timeout
소유물.
다음과 같이 값을 설정할 수 있습니다.application.properties
파일
spring.datasource.hikari.maxLifeTime : 600000 #10 minutes wait time
저 같은 경우에는 이 설정을 통해 문제를 해결했습니다.
@Configuration
public class HikariSetting{
@Bean
public HikariConfig config() {
HikariConfig hikariConfig = new HikariConfig();
// other setting
hikariConfig.addDataSourceProperty("socketTimeout", 600000);
hikariConfig.setMaxLifetime(600000);
return hikariConfig;
}
}
이것을 참조하다
언급URL : https://stackoverflow.com/questions/60310858/possibly-consider-using-a-shorter-maxlifetime-value-hikari-connection-pool-spr
반응형
'programing' 카테고리의 다른 글
CIDR 표기의 IP 주소는 무엇입니까? (0) | 2023.03.07 |
---|---|
Typescript와 함께 스타일링된 컴포넌트를 사용하면 프로펠러가 존재하지 않습니까? (0) | 2023.03.07 |
WP용 Woocommerce의 wc_add_to_cart_message 훅 대체 수단 (0) | 2023.03.07 |
플러그인 활성화 후 리디렉션 (0) | 2023.03.07 |
Response' 개체가 구독 가능한 Python http post 요청이 아닙니다. (0) | 2023.03.07 |