그담
1. Clustering에 참여하는 각각의 tomcat 서버의 server.xml 에
<Cluster
className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> 부분 주석처리 해제
1.1 보다 상세한 설정 및 물리 장비가다 다를 경우 다음을 각 server.xml에 추가
그리고 Receiver의 아이피와 포트를 수정
2. WEB-INF/web.xml에 <distirbutable/>추가
3. 구동 확인
start시 catalina.out.out에 다음과 같은 로그가 나오면 됨
3.1 구동시 에러메세지
구동시 다음과 같은 에러 메세지가 나올 수 있다
이럴땐 /etc/hosts파일을 수정해 준다
다음을 제일 밑에 추가
4. 테스트 - webcontent폴더에 index.jsp를 다음과 같이 만든다
4.1 인스턴스를 2개 뛰우고 하나씩 죽여가면서 다음 화면과 같이 sessionId는 같고 worker가 달라지는 것을 확인하면 완료된 것이다
(크롬에서이나 익스플로러에서 확인해볼 것)
1번 인스턴스만 살아 있을때 또는 동시에 2개 다 살아있을때
2번 인스턴스만 살아있을때
[root@tpwas conf]# pwd
/svc/spi/was/tomcat/spiWas2/conf
[root@tpwas conf]# vi server.xml
=====================================================================================
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
=====================================================================================
|
1.1 보다 상세한 설정 및 물리 장비가다 다를 경우 다음을 각 server.xml에 추가
그리고 Receiver의 아이피와 포트를 수정
<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.105" port="45564" frequency="500" dropTime="3000"/> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="현재 서버아이피" port="4001 서버마다틀리게" 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.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>
2. WEB-INF/web.xml에 <distirbutable/>추가
[root@tpwas WEB-INF]# pwd
/home/spiwas/dist/WebContent/WEB-INF
[root@tpwas WEB-INF]# vi web.xml
==================================================================================================
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Clustering Test</display-name>
<distributable/>
</web-app>
==================================================================================================
|
3. 구동 확인
start시 catalina.out.out에 다음과 같은 로그가 나오면 됨
정보: Replication member added:org.apache.catalina.tribes.membership.MemberImpl[tcp://{127, 0, 0, 1}:4000,{127, 0, 0, 1},4000, alive
=5012, securePort=-1, UDP Port=-1, id={31 -5 48 -9 -27 64 79 67 -81 49 -44 96 -87 -84 -115 -121 }, payload={}, command={}, domain={}
, ]
|
3.1 구동시 에러메세지
구동시 다음과 같은 에러 메세지가 나올 수 있다
이럴땐 /etc/hosts파일을 수정해 준다
½É°¢: Failed bind replication listener on address:auto
java.net.UnknownHostException: tpwas: tpwas
at java.net.InetAddress.getLocalHost(InetAddress.java:1402)
at org.apache.catalina.tribes.transport.ReceiverBase.getBind(ReceiverBase.java:201)
at org.apache.catalina.tribes.transport.nio.NioReceiver.start(NioReceiver.java:110)
at org.apache.catalina.tribes.group.ChannelCoordinator.internalStart(ChannelCoordinator.java:145)
at org.apache.catalina.tribes.group.ChannelCoordinator.start(ChannelCoordinator.java:99)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162)
at org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.start(MessageDispatchInterceptor.java:157)
at org.apache.catalina.tribes.group.ChannelInterceptorBase.start(ChannelInterceptorBase.java:162)
at org.apache.catalina.tribes.group.GroupChannel.start(GroupChannel.java:419)
at org.apache.catalina.ha.tcp.SimpleTcpCluster.startInternal(SimpleTcpCluster.java:685)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1106)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:691)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
2014. 2. 26 ¿ÀÀü 10:59:27 org.apache.catalina.tribes.transport.ReceiverBase getBind
|
다음을 제일 밑에 추가
[root@tpwas logs]# vi /etc/hosts
127.0.0.1 localhost 시스템 이름 localhost
|
4. 테스트 - webcontent폴더에 index.jsp를 다음과 같이 만든다
[root@tpwas WebContent]# pwd
/home/spiwas/dist/WebContent
[root@tpwas WebContent]# vi index.jsp
=====================================================================================
<%
session.setAttribute("a","a");
%>
<html>
<head>
<title>Test JSP</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#CCCCCC">
<td width="13%">Tomcat1 Machine</td>
<td width="87%"> </td>
</tr>
<tr>
<td>Session ID :</td>
<td><%=session.getId()%></td>
</tr>
</table>
<div>Im WAS server hello snowman</div>
</body>
</html>
=====================================================================================
|
4.1 인스턴스를 2개 뛰우고 하나씩 죽여가면서 다음 화면과 같이 sessionId는 같고 worker가 달라지는 것을 확인하면 완료된 것이다
(크롬에서이나 익스플로러에서 확인해볼 것)
1번 인스턴스만 살아 있을때 또는 동시에 2개 다 살아있을때
2번 인스턴스만 살아있을때
댓글 없음:
댓글 쓰기