세션클러스터링을 이용하기 위해 검색하면 많이 나오는 방법을 사용했지만 리눅스 eth0 설정부터

방화벽등으로 쉽지 않음.

 

WAS끼리 직접 서로 주고 받게 설정.

 

<Engine 설정의 맨 마지막 부분 jvmRoute는 apache에서 mod_jk 명칭으로 변경

 

<Receiver 의 설정은 현재 Was에서 받는 IP 및 Port 를 설정

<Member 의 내용은 세션클러스터링 할 WAS IP 및 PORT 설정을 각자 맞게 넣고 설정하면 됨.

uniqueId 의 내용은 맨 끝의 1번 WAS에서는 2로 설정 2번 WAS에서는 1로 설정

 

1번 WAS 클러스터링

<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
        <!-- clustering -->
        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8"  channelStartOptions="3">
                <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/>
                <Channel className="org.apache.catalina.tribes.group.GroupChannel">
                        <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="127.0.0.1"
                        port="4055"
                        autoBind="0"
                        selectorTimeout="5000"
                        maxThreads="6"/>

                        <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor" staticOnly="true"/>
                        <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector" />
                        <Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor">
                        <Member
                                className="org.apache.catalina.tribes.membership.StaticMember"
                                port="4056"
                                host="127.0.0.1"
                                uniqueId="{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2}"
                        />
                        </Interceptor>
                        <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor"/>
                </Channel>

                <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;" />
                <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
                <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener" />
        </Cluster>
        <!-- clustering  -->

 

2번 WAS

<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">
        <!-- clustering -->
        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8"  channelStartOptions="3">
                <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/>
                <Channel className="org.apache.catalina.tribes.group.GroupChannel">
                        <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="127.0.0.1"
                        port="4056"
                        autoBind="0"
                        selectorTimeout="5000"
                        maxThreads="6"/>

                        <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor" staticOnly="true"/>
                        <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector" />
                        <Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor">
                        <Member
                                className="org.apache.catalina.tribes.membership.StaticMember"
                                port="4055"
                                host="127.0.0.1"
                                uniqueId="{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}"
                        />
                        </Interceptor>
                        <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor"/>
                </Channel>

                <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;" />
                <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
                <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener" />
        </Cluster>
        <!-- clustering  -->

 

의 설정으로 실행 후 정상적으로 세션클러스터링이 동작함.

물론 iptables에서 각 4055, 4056 포트는 열어줌..

'개발자 > Server' 카테고리의 다른 글

톰켓 운영 옵션  (0) 2019.01.18
톰켓 심볼릭 링크 인식하기  (1) 2019.01.03
PHP CONFIGURE  (0) 2014.05.23
MYSQL CONFIGURE  (0) 2014.05.23
mysql 외부연결  (0) 2014.05.23
Posted by Swamp of hope
,

한동안 톰켓 6버전만 사용하고 7버전때 잠깐 고생했던거 같은데 1년전이라 기억도 안남.


심볼릭링크로 연결된 upload 폴더가 톰켓 8.5버전에서 인식이 안됨.


<-- 기존 사용법 -->
<Host name="localhost" docBase="webaaps" allowlinking="true" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="경로" reloadable="true" useHttpOnly="false" allowLinking="true" />
</Host>
<!-- 변경1 -->
<Host name="localhost" docBase="webaaps" allowlinking="true" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="경로" reloadable="true" useHttpOnly="false">
<Resources allowLinking="true" />
</Context>
</Host>
<!-- 변경2 -->
<Host name="localhost" docBase="webaaps" allowlinking="true" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="경로" reloadable="true" useHttpOnly="false">
<Resources>
<PreResourcesa
className="org.apache.catalina.webresources.DirResourceSet"
base="경로/upload"
webAppMount="/upload"
internalPath="/"/>
</Resources>
</Context>
</Host>

이것 저것 다 시도 해봤으나 적용 안됨.
안그래도 바쁜 시기에 별것도 아닌거 가지고 한시간을 날려버럼..

Tomcat 폴더/conf/context.xml 안에 
<Context> 태그가 있다 그 안에 

<Resources allowLinking="true" />

한줄 넣고 모든게 해결.


'개발자 > Server' 카테고리의 다른 글

Tomcat 세션 클러스터링 멀티캐스트를 이용하지 않는 방법.  (2) 2020.01.15
톰켓 운영 옵션  (0) 2019.01.18
PHP CONFIGURE  (0) 2014.05.23
MYSQL CONFIGURE  (0) 2014.05.23
mysql 외부연결  (0) 2014.05.23
Posted by Swamp of hope
,