1. 程式人生 > >單臺主機上啟動多個JBOSS的配置

單臺主機上啟動多個JBOSS的配置

1.JBoss提供了一種簡便的方法:Binding Manager服務,不需要繁瑣的埠配置就可以實現多例項執行埠不衝突,詳細步驟如下:
以JBoss 4.2.3 GA為例,%JBOSS_HOME%\docs\examples\binding-manager\sample-bindings.xml,該檔案預設情況下定義了4組不同的埠配置(ports-default、ports-01、ports-02、ports-03),也就是說預設情況下支援同一臺機器部署4個JBoss例項。

2.將server應用下的default複製一份改名為node2.

3.修改node2/conf/jboss-service.xml檔案,配置Service Binding(預設註釋,取消注視修改ports-01/ports-02/ports-03即可)如下:

<!--
      | 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-02</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>

4.修改node2/deploy\jboss-web.deployer\server.xml配置檔案

<Connector port="8067" address="0.0.0.0"    
         maxThreads="250" maxHttpHeaderSize="8192"
         emptySessionPath="true" protocol="HTTP/1.1"
         enableLookups="false" redirectPort="8443" acceptCount="100"
         connectionTimeout="20000" disableUploadTimeout="true" />

5.啟動例項,訪問埠為8067。