4.5. Running multiple instances of JBoss AS
Please note that automated updating of instances created using methods below is not supported. If you create custom instances, you will manually have to port files / changes from a new update to that instance.
The description here is restricted to running multiple instances of the JBoss AS Linux service. Running multiple instances with run.sh is already described elsewhere in the JBoss AS documentation.
You can administer multiple SysV services that run JBoss AS by creating additional service scripts. The process basically consists of:
creating a link with the new service name to the original jbossas init script in /etc/init.d
copying the jbossas file in /etc/sysconfig to one with the new service name (the init script and the configuration file names must match)
making the desired configuration changes making sure:
port conflicts are avoided
a different log file is specified
The original init script log files are created under /var/log/jbossas in directories that correspond to the configuration used (like 'default') with the usual server.log name. For instance:
/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 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/, uncomment and update the value of the service-nameJBOSS_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.
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