JBoss 세션 클러스터링 설정 방법입니다.
standalone.xml, jboss-web.xml , web.xml 파일을 이용하여 클러스터링을 설정합니다.
1. standalone.xml : module 추가
<extensions> <extension module="org.jboss.as.clustering.infinispan"/> <extension module="org.jboss.as.clustering.jgroups"/>
2. standalone.xml : jgroups udp, tcp 통신 추가 (사용하시는 설정만 추가하시면 됩니다.)
-----------------------------------------------------------------------------------------------------------------------------
<subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="udp"> <stack name="udp"> <transport type="UDP" socket-binding="jgroups-udp"/> <protocol type="PING"/> <protocol type="MERGE3"/> <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/> <protocol type="FD"/> <protocol type="VERIFY_SUSPECT"/> <protocol type="pbcast.NAKACK"/> <protocol type="UNICAST2"/> <protocol type="pbcast.STABLE"/> <protocol type="pbcast.GMS"/> <protocol type="UFC"/> <protocol type="MFC"/> <protocol type="FRAG2"/> <protocol type="RSVP"/> </stack>
--------------------------------------------
3. standalone.xml : 포트 설정 추가
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}"> <socket-binding name="jgroups-udp" port="11111" multicast-address="${jboss.default.multicast.address:1.1.1.1}" multicast-port="22222"/> <socket-binding name="jgroups-udp-fd" port="33333"/> </socket-binding-group>
4. standalone.xml : infinispan 설정 distributed-cache 이름에 dist 추가
<subsystem xmlns="urn:jboss:domain:infinispan:1.4"> <cache-container name="web" aliases="standard-session-cache" default-cache="repl" module="org.jboss.as.clustering.web.infinispan"> <distributed-cache name="dist" l1-lifespan="0" mode="ASYNC" batching="true"> <file-store/> </distributed-cache> </cache-container>
5. jboss-web.xml : replication-config 설정
<replication-config> <replication-trigger>SET</replication-trigger> <replication-granularity>SESSION</replication-granularity> </replication-config>
6. web.xml : distributable 설정 추가
<distributable/>