728x90
반응형
스프링부트(sprintboot) 환경에서 세션 클러스터링 적용시 유의해야할 부분
1. (tomcat) /conf/server.xml 설정
<Cluster> 설정과 그 안의 <Membership> 설정시 포트 충돌 유의
2. (tomcat) /conf/context.xml 설정
두 서버간 sessionCookieName 설정을 동일하게 할 것
WatchedResource에 web.xml 명시
3. web.xml
<distributable /> 태그 추가
*정 안 되면 war 파일 내에 아래 내용으로 /WEB-INF/web.xml을 추가
<web-app version="3.0">
<distributable />
</web-app>
4. logging.properties 내용 추가
아래 세 줄을 추가하면 두 was 간 공유되는 세션 내용을 상세히 알 수 있음
org.apache.catalina.ha.session.DeltaManager.level = FINEST
org.apache.catalina.ha.tcp.SimpleTcpCluster.level = FINEST
org.apache.catalina.tribes.level = FINEST
5. 모든 세션 데이터에 직렬화(serialize) 적용
세션에 들어가는 모든 데이터를 직렬화 해야 한다.
그렇지 않은 경우에는 catalina.out에서 "setAttribute: Non-serializable attribute [변수명]" 이런 메시지를 확인 할 수 있음
ex.
import java.io.serialize
public class sessionDATA implement Serializable
6. pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
spring-boot-starter-tomcat 이 있다면 <scope> provided </scope> 추가
빌드할 때는 해당 디팬던시를 사용하지만, 실제로는 사용하지 않겠다는 뜻
별도의 외부 tomcat이 있는 이중화 환경에서 springboot의 내장 tomcat을 사용하지 않는다는 의미다.
728x90
반응형
'how to' 카테고리의 다른 글
how to upgrade tomcat (0) | 2025.07.02 |
---|---|
how to fix : Java Algorithm constraints check failed on key RSA with size of 1024bits (0) | 2025.04.24 |
how to fix Error response from daemon: unable to create manifests file: NotFound: content digest (0) | 2025.03.31 |
how to set platform and docker pull (0) | 2024.10.23 |
how to install docker standalone (0) | 2024.10.11 |
how to set "CyberChef" in synology using docker. (1) | 2024.04.22 |
how to use Dockerfile (0) | 2023.11.03 |
how to use pwndocker (0) | 2023.08.22 |
how to Copy the highlighted source code from visual studio to word (0) | 2023.07.23 |
how to solve "adb push" or "adb install" not working (0) | 2023.05.25 |
댓글