Running multiple instances of JBoss AS using different sets of ports
15
/var/log/jbossas/default/server.log
In general, each log file is created by the SysV script as
/var/log/
service-name
/$JBOSSCONF/server.log
so no file conflicts shall exist.
For more flexibility in the configuration of the different servers, you may want to create full copies of
JBOSS_HOME
. This is described in
Section 4.3, “ Creating copies of
JBOSS_HOME
”
above -- make sure
you use the
cp
command's
p
switch to preserve the
jboss
user and group ownership. Then, in
/
etc/sysconfig/
service-name
, uncomment and update the value of the
JBOSS_HOME
variable.
Optionally, you can just uncomment and change the value of
JBOSS_HOME
as described above so
as to specify an empty or non-existent directory and the script will automatically create a copy of
the RPM-installed
/var/lib/jbossas
(original
JBOSS_HOME
) for you when the service is first
started. The current "minimal", "production", "default" and "all" configurations will be copied. Make sure
the parent directory, in case of a new directory, or the directory itself, if already existent, have write
permissions for the user
jboss
.
Note
Starting the server this first time may take a little longer due to the file copying.
There are 2 ways to run additional instances of JBoss AS and avoid port conflicts:
• By using different sets of ports
• By binding to different local IP addresses
4.5.1. Running multiple instances of JBoss AS using different sets
of ports
Using different sets of ports
The BindingManager in JBoss AS can be used to dynamically override service configurations
(e.g. port numbers). Jbossas has some pre-configured overrides, namely
ports-01
,
ports-02
and
ports-03
. The configuration file can be found at
/var/lib/jbossas/docs/examples/
binding-manager/sample-bindings.xml
. These sets of overrides can be used when multiple
instances of JBoss AS must be started. Please follow these steps when multiple instance of JBoss AS
need to be started:
1. Create a new file
/etc/init.d/
service-name
which is a symlink to
/etc/init.d/jbossas
,
e.g:
ln -s /etc/init.d/jbossas /etc/init.d/jbossas-ports-01
2. Create a new config file for
service-name
,
/etc/sysconfig/
service-name
. The contents
of this file should be similar to
/etc/sysconfig/jbossas
, except with instance specific values
uncommented and updated, e.g: