다수의 인스턴스를 올리는 이유는 여러가지가 있을 테지만 하나의 큰 메모리를 사용하는 JVM을 사용하는 WAS를 구동 시키는 것보다 1G내외로 2~3개의 JVM을 올리는 것이 효과적이라는 말이 있는데 그거는 사실 잘 모르겠다.
위의 경우 말고 다른 경우는 아마도 다수의 WAS를 구동해야 되나 하드웨어 지원이 넉넉치 않을때 Multi Instance로 구동 하는 경우가 있다.
JBOSS 에서 Multi Instance로 구동 하는 방법에는 크게 두가지가 있다.
한가지는 Binding IP를 이용해서 구동하는 방법, 다른 하나는 Port Binding을 이용해서 구동하는 방법이 있다.
- Binding IP를 이용해서 구동 하는 방법
Binding IP를 이용하는 방법은 이외로 간단하다
먼저 NIC에 alias를 이용해 Binding 할 IP를 설정을 한다.
그런 다음 올릴 서버 프로파일을 설정한 뒤 run 스크립트에서 다음과 같이 입력하고 구동하면은 Binding IP를 이용한 방법은 손쉽게 끝나게 된다.
run.sh -c {구동할 서버 프로파일} -b {Binding IP}
이와 같이 하고 구동하면은 Binding IP를 이용한 멀티 인스턴스 사용이 가능하다.
- Binding Manager를 이용한 방법
Binding Manager를 이용한 방법은 ${JBOSS_HOME}/jboss-as/server/${Server_Profile}/conf 에 보면은 jboss-service.xml 이라는 파일을 수정함으로써 Multi Instance로 구동 할 수 있다.
jboss-service.xml에 보면은 아래와 같은 내용이 있다.
<!-- ==================================================================== -->
<!-- Service Binding -->
<!-- ==================================================================== -->
<!-- Automatically activated when generatting the clustering environment -->
<!-- @TESTSUITE_CLUSTER_CONFIG@ -->
<!--
| Binding service manager for port/host mapping. This is a sample
| config that demonstrates a JBoss instances with a server name 'ports-01'
| loading its bindings from an XML file using the ServicesStoreFactory
| implementation returned by the XMLServicesStoreFactory.
|
| ServerName: The unique name assigned to a JBoss server instance for
| lookup purposes. This allows a single ServicesStore to handle mulitiple
| JBoss servers.
|
| StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore
| during initialization that specifies how to connect to the bindings store.
| StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface
| implementation to create to obtain the ServicesStore instance.
<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<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>
-->
위와 같이 코멘트 처리가 되어 있는데 이 코멘트를 삭제 하고 사용하면은 된다.
기본적인 port 관련은 정보 설정은 위에 보이는 파일에 보면은 3개 정도 정의가 되어 있다.
3개를 초과해서 만드는 경우라면은 구성을 사용자가 잡아줘야 되는데 한 서버에 인스턴스 3개 이상 올리는 거는 그닥 좋다고 생각하지는 않는다.




