jaikiran pai [
http://community.jboss.org/people/jaikiran] created the document:
"Multiple instances of JBoss AS7 on the same machine"
To view the document, visit:
http://community.jboss.org/docs/DOC-16705
--------------------------------------------------------------
h4. Overview:
This wiki explains how multiple instances of JBoss AS7 +standalone+ server, on single
physical system, can be started simultaneously.
h4. Approach#1
[Tested against JBoss AS7.0.0 Beta2 and AS7 upstream dated April 8 2011]
In this approach we will create multiple copies of JBoss AS7 on a single system.
* Download JBoss AS7. And unzip it to some location. Let's call this instance
<jboss-as-7-one>
* As a sanity test, just start this server once, by running the following script from the
<jboss-as-7-one>/bin folder:
jpai@jpai-laptop:bin$ ./standalone.sh
* Make sure the server starts without any errors. Once it has started, shutdown the server
by using Ctrl + C
* Let's now copy the entire <jboss-as-7-one> instance to <jboss-as-7-two>.
We now have 2 copies of JBoss AS7 on our system.
* Our next step is to configure the second instance to use a different IP address to bind
the services to. By default, <jboss-as-7-one> instance uses 127.0.0.1 as the IP
address to bind the services to. This in configured in
JBOSS_HOME/standalone/configuration/standalone.xml file (only relevant sections pasted
below):
...
<management-interfaces>
<native-interface interface="default" port="9999"/>
<http-interface interface="default" port="9990"/>
</management-interfaces>
...
<interfaces>
<interface name="default">
<inet-address value="127.0.0.1"/>
</interface>
<interface name="any">
<any-address/>
</interface>
<interface name="complex">
<any>
<subnet-match value="192.168.0.0/16"/>
<public-address/>
</any>
<not>
<site-local-address/>
</not>
<up/>
<multicast/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets"
default-interface="default">
<socket-binding name="jndi" port="1099"/>
<socket-binding name="jmx-connector-registry"
port="1090"/>
<socket-binding name="jmx-connector-server"
port="1091"/>
<socket-binding name="http" port="8080"/>
<socket-binding name="https" port="8447"/>
<socket-binding name="osgi-http" port="8090"/>
<socket-binding name="remoting" port="4447"/>
<socket-binding name="txn-recovery-environment"
port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<socket-binding name="txn-socket-process-id"
port="4714"/>
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput"
port="5455"/>
</socket-binding-group>
As can be seen, the management interface and the socket bindings, all use the interface
named "default", which binds to 127.0.0.1.
* Now for <jboss-as-7-two> let's configure this file to use a different
interface.
* Open the <jboss-as-7-two>/standalone/configuration/standalone.xml in a text editor
and a custom interface to the <interfaces> section. In this example, we'll name
the new interface "specific-ip-interface" and let it bind to a specific IP
XXX.YYY.AAA.BBB (should be a valid IP address). So here's the new interface
definition:
<interfaces>
<interface name="default">
<inet-address value="127.0.0.1"/>
</interface>
<!-- New interface for our second instance -->
<interface name="specific-ip-interface">
<inet-address value="XXX.YYY.AAA.BBB"/>
</interface>
<interface name="any">
<any-address/>
</interface>
<interface name="complex">
<any>
<subnet-match value="192.168.0.0/16"/>
<public-address/>
</any>
<not>
<site-local-address/>
</not>
<up/>
<multicast/>
</interface>
</interfaces>
* Our next step is to let the socket bindings and the management interface, use this new
interface instead of the default one.
* So continue editing the <jboss-as-7-two>/standalone/configuration/standalone.xml
and point the management interface and socket bindings to use this new interface as
follows:
...
<management-interfaces>
<native-interface interface="specific-ip-interface"
port="9999"/>
<http-interface interface="specific-ip-interface"
port="9990"/>
</management-interfaces>
...
<interfaces>
<interface name="default">
<inet-address value="127.0.0.1"/>
</interface>
<!-- New interface for our second instance -->
<interface name="specific-ip-interface">
<inet-address value="XXX.YYY.AAA.BBB"/>
</interface>
<interface name="any">
<any-address/>
</interface>
<interface name="complex">
<any>
<subnet-match value="192.168.0.0/16"/>
<public-address/>
</any>
<not>
<site-local-address/>
</not>
<up/>
<multicast/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets"
default-interface="specific-ip-interface">
<socket-binding name="jndi" port="1099"/>
<socket-binding name="jmx-connector-registry"
port="1090"/>
<socket-binding name="jmx-connector-server"
port="1091"/>
<socket-binding name="http" port="8080"/>
<socket-binding name="https" port="8447"/>
<socket-binding name="osgi-http" port="8090"/>
<socket-binding name="remoting" port="4447"/>
<socket-binding name="txn-recovery-environment"
port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<socket-binding name="txn-socket-process-id"
port="4714"/>
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput"
port="5455"/>
</socket-binding-group>
* Save the changes. That's it for configurations. Now let's start these individual
instances.
* From the command prompt, go to <jboss-as-7-one>/bin and run the following
command:
jpai@jpai-laptop:jboss-as-7-one/bin$ ./standalone.sh
* Run the same command from <jboss-as-7-two>/bin:
jpai@jpai-laptop:jboss-as-7-two/bin$ ./standalone.sh
You'll now have 2 different instances of JBoss AS7 running on the same physical
system.
h4. Approach#2(?)
--------------------------------------------------------------
Comment by going to Community
[
http://community.jboss.org/docs/DOC-16705]
Create a new document in JBoss AS7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=102&am...]