"일꾼이 일을 잘하려면 먼저 도구를 갈고 닦아야 한다." - 공자, 『논어』.
첫 장 > 프로그램 작성 > 최대 절전 모드로 스프링 부팅에서 424 시간 후에 데이터베이스 연결 손실을 방지하는 방법은 무엇입니까?

최대 절전 모드로 스프링 부팅에서 424 시간 후에 데이터베이스 연결 손실을 방지하는 방법은 무엇입니까?

2025-03-22에 게시되었습니다
검색:747

How to Prevent Database Connection Loss After 424 Hours in Spring Boot with Hibernate?

: com.mysql.jdbc.exceptions.jdbc4.communicationsexception : 서버에서 성공적으로받은 마지막 패킷은 56,006,037 밀리 초 전입니다. 서버로 성공적으로 전송 된 마지막 패킷은 56,006,037 밀리 초 전입니다. 'Wait_Timeout'의 서버 구성 값보다 길다. 응용 프로그램에서 사용하기 전에 만료 및/또는 테스트 연결 유효성을 고려하거나 클라이언트 타임 아웃의 서버 구성 값을 늘리거나 커넥터/J 연결 속성 'AutoreConnect = true'를 사용 하여이 문제를 피하려면

이 문제를 해결하려면 응용 프로그램 구성 파일에서 적절한 연결 속성을 구성하는 것이 좋습니다. Application.Properties) :
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 56,006,037 milliseconds ago.  The last packet sent successfully to the server was 56,006,037 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.

# 연결 유효성 검사 및 풀 구성 Spring.datasource.max-Active = 10 spring.datasource.initial-size = 5 spring.datasource.max-idle = 5 spring.datasource.min-idle = 1 # 정기 연결 유효성 검사 spring.datasource.test-while-idle = true spring.datasource.validation-query = select 1 # 유휴 연결 관리 Spring.datasource. 타임-벤드-벤트-런스-밀리 스 = 5000 Spring.datasource.min-Evictable-Idle-Millis = 60000

이 설정은 연결 풀을 다음과 같이 가능하게합니다. (Spring.datasource.test-While-Idle). 비활성의 장기간 후에도 데이터베이스 연결. 
릴리스 선언문 이 기사는 1729757864에 재현됩니다.
최신 튜토리얼 더>

부인 성명: 제공된 모든 리소스는 부분적으로 인터넷에서 가져온 것입니다. 귀하의 저작권이나 기타 권리 및 이익이 침해된 경우 자세한 이유를 설명하고 저작권 또는 권리 및 이익에 대한 증거를 제공한 후 이메일([email protected])로 보내주십시오. 최대한 빨리 처리해 드리겠습니다.

Copyright© 2022 湘ICP备2022001581号-3