Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- Was
- JEUS
- ua-parser
- Login
- dbms
- web server
- 알고리즘
- WebtoB
- Java
- 개발자도구
- WINDOW11
- AES
- FCM
- URLRewirte
- eGov
- mysql
- TailMe
- 접근장치
- Tomcat
- window10
- 브라우저
- 물리적주소
- scheduled
- Oracle
- programmers
- db
- User-Agent
- Firebase
- @Scheduled
- 암호화
Archives
- Today
- Total
HD
session clustering 적용 (feat.Tomcat7 이상) 본문
반응형
이번 프로젝트를 하면서 session clustering 적용하면서 내용을 정리...
-tomcat jvmRoute설정
session clustering을 설정한다는건 apache기준 workers.properties를 설정을 해줬을것이다.
jvmRoute에 지정한 worker 명을 넣어주면 된다.
빨간색 부분은 중복되지 않은 공유의 톰캣을 구분 값
<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker3_22">
아래 이미지 처럼 JSESSIONID에 .worker3_22로 tomcat을 구분할수 있다.
- WEB-INF/web.xml (distributable 태그 추가)
<!-- web.xml -->
<distributable/>
- tomcat server.xml (tomcat8 기준)
- multicast 방식으로 동작하며 address는 ‘228.0.0.4’, port는 ‘45564’를 사용하고 서버 IP는 java.net.InetAddress.getLocalHost().getHostAddress()로 얻어진 IP 값으로 송출됩니다.
- 먼저 구동되는 서버부터 4000 ~ 4100 사이의 TCP port를 통해 reqplication message를 listening합니다.
- Listener는 ClusterSessionListener, interceptor는 TcpFailureDetector와 MessageDispatchInterceptor가 설정됩니다.
※ 각 다른 서버에 적용할땐 <Membership> port="45564" <Receiver> port="4000"을 다르게 해야한다.
ex)<Membership> port="45565" <Receiver> port="4001"
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
<Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/>
<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.McastService"
address="228.0.0.4"
port="45564"
frequency="500"
dropTime="3000"/>
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto"
port="4000"
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>
<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
</Sender>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor"/>
</Channel>
<Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>
<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>
※참고 tomcat.apache.org/tomcat-8.5-doc/cluster-howto.html
- tomcat server.xml (tomcat7 기준)
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
<Manager className="org.apache.catalina.ha.session.BackupManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"/>
<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.McastService"
address="228.0.0.4"
port="45564"
frequency="500"
dropTime="3000"/>
<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
</Sender>
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
address="auto"
port="4000"
autoBind="100"
selectorTimeout="5000"
maxThreads="6"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
</Channel>
<Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>
<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
<ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>
※참고 tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html
반응형
'WAS > Tomcat' 카테고리의 다른 글
Tomcat Server.xml 암호화 (feat.AES) (0) | 2022.06.23 |
---|---|
리눅스 톰켓 한글 깨짐 현상 해결 (0) | 2022.03.08 |
TOMCAT 버전업 문제 (0) | 2020.08.04 |
Tomcat JDK변경 (0) | 2020.07.13 |
Tomcat ORACLE JNDI Datasource 설정 (0) | 2019.01.23 |
Comments