먼저 JBOSS 를 설치 한 후 ALL 을 카피하여 만들고 싶은 노드를 만들고 만일 같은 머신상에 위치하고 IP 가 하나일 경우BingdingManager 를 이용하여 포트를 바꾸어 줍니다.
Ex) conf/jboss-service.xml에서 ServiceBindingManager를 활성화(주석을 풀어주고 사용 ServerName 은 ports-03 까지 사용할 수 있음)
<attribute name="ServerName">ports-01</attribute>
<attribute name="StoreURL">${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml</attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>
클러스터 구성 파일
? deploy/cluster-service.xml
? deploy/jboss-web-cluster.sar/META-INF/jboss-service.xml
? ejb3-clustered-sfsbcache-service.xml
- ejb3-entity-cache-service.xml
ex) 해당 configuration 에서 ./deploy/cluster-service.xml 에서 클러스터 정의를 합니다.
<mbean code="org.jboss.ha.framework.server.ClusterPartition"
name="jboss:service=${jboss.partition.name:DefaultPartition}"> // clustering 네임을 설정합니다.
<attribute name="PartitionName">${jboss.partition.name:DefaultPartition}</attribute>
<attribute name="NodeAddress">${jboss.bind.address}</attribute>
<attribute name="DeadlockDetection">False</attribute>
<attribute name="StateTransferTimeout">30000</attribute>
<attribute name="PartitionConfig">
<Config>
<UDP mcast_addr="${jboss.partition.udpGroup:228.1.2.3}" mcast_port="45566"
ip_ttl="${jgroups.mcast.ip_ttl:8}" ip_mcast="true"
mcast_recv_buf_size="2000000" mcast_send_buf_size="640000"
ucast_recv_buf_size="2000000" ucast_send_buf_size="640000"
loopback="false"/>
…
</mbean>
<mbean code="org.jboss.ha.hasessionstate.server.HASessionStateService"
name="jboss:service=HASessionState">
…
</mbean>
해당 클러스터에 참여 하는 partition 네임은 같아야 합니다. 위의 정의 에서는 DefaultPartition 이
라설정한 것이 고 다른 이름으로 바꾸시는 것이 좋습니다.
해당 cluster 설정파일에서 설정하지 않으면 서버구동스크립트의 Java Option에서 -Djboss.partition.name=XXX 설정하시면 됩니다. 또는 start script에서 run.sh ?c all ?b
203.231.14.15 ?g XXX 으로 바꾸 시면 됩니다.
클러스터링에 참여하는 서버들은 멀티캐스트 IP 와 port 로 서로의 상태를 복제합니다. 먼저 해당 멀티캐스트 IP 가 통신이 되는지부터 확인 하셔야 됩니다.
=================================================================
멀티캐스트 테스트 하시는 방법은
★ 멀티캐스트 IP 설정
? 멀티캐스트 대역에서 선택 - 224.0.0.1 ~ 239.255.255.254
? -u X.X.X.X
? -Djboss.partition.udpGroup=X.X.X.X
★ JBoss 4.2에서는 multicast port도 설정 가능 (*)
? -Djboss.hapartition.mcast_port=45566
? -Djboss.webpartition.mcast_port=45577
? -Djboss.ejb3sfsbpartition.mcast_port=45551
? -Djboss.ejb3entitypartition.mcast_port=43333
★ 멀티캐스트 테스트
Receiver Test
Sender Test
jgroups.jar는 $JBOSS_HOME/server/all/lib 아래에 위치
====================================
? 멀티캐스트 테스트에 실패했을 때
? 해당 NIC의 멀티캐스트를 활성화
? ifconfig eth0 MULTICAST
? 해당 NIC로 멀티캐스트 메시지가 가도록 라우팅
? NIC가 여러 개일 경우
? route add -net 224.0.0.0 netmask 224.0.0.0 dev eth0
? OS에 방화벽이 설치되어 있는지 확인
? OS 방화벽이 있다면 멀티캐스트에 사용할 포트를 열어야 함
"iptables -F"
? Network Switch가 멀티캐스트를 지원하는지 확인
? 멀티캐스트 테스트는 통과했는데 클러스터 동작이 안될 때
? /etc/hosts 파일의 127.0.0.1에 호스트가 설정된 경우 이를 제거
127.0.0.1 yourhostname yourhostname.yourdomain localhost.localdomain localhost





