Friday, May 21, 2010

Getting multiple JBoss 4.x instances to run in a multihomed server

If you have configured your server to be multihomed (server multiple IP addresses), to get multiple JBoss instances to serve each IP address per JBoss instance without traffic conflict, you need to do the following:

1. Modify run.sh scripts to associate one JBoss instance to one IP address and another JBoss instance to another IP address (add -b right before "$@")

2. If using one of the jboss_init_.sh scripts for autostart on boot, modify the "# Provides: jboss" line so that each instance has a unique name. Multiple scripts can't have the same provider name on the same box. Use the version of the script in 4.2.3 which doesn't require passing the username and password in the command line to stop JBoss when JBoss is secured. To make these scripts available to users so that those who can sudo su - jboss can start and stop the servers:

a. cp /etc/init.d/[script name] /sbin
b. Modify script in sbin to sudo su - jboss instead of su - jboss
c. Delete the line, "cd $JBOSS_HOME/bin"

3. For each JBoss instance, add or edit the [JBOSS_HOME]/server/default/conf/jndi.properties file and make sure it contains the following three lines:

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=[IP address]:1099

4. Create a [JBOSS_HOME]/server/default/conf/multihomedprops directory and copy the above jndi.properties file into it

5. Edit the [JBOSS_HOME]/bin/run.sh file and add the following line after the last section of code where the $JBOSS_CLASSPATH variable is modified in any way:

JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JBOSS_HOME/server/default/conf/multihomedprops"

No comments: