Multiple JBoss instances step by step

So you have got JBoss working on your linux box, if you did it manually then it
was a long hard fight involving start up scripts and file permission’s, but its
not enough, you want more, maybe you want to try out clustering, maybe you want
a dev and a live instance but only have one box, who knows, who cares, you just
want it, so step by step here it is:

“JBoss” = is the both the name of the existing instance and the user its
installed under (as per JBoss defaults)
“jbossXXX” = the name of the new instance and user
“Jboss-4.0.5.GA” = the JBoss install directory

0) I’m assuming you have already added your multiple IP addresses if not go
here if you are doing it with only 1 IP address and different ports then go
away as i don’t like you anymore, also you should be running in text only mode
for efficiency, if your running a gui then shame on you, and finally you should
be logged on as root or have equivalent rights

1) useradd jbossXXX
(this will create your user and their home directory)

2) passwd jbossXXX
(then enter the new password at the prompt, if you don’t do this the user wont
be activated)

2) passwd jbossXXX
(then enter the new password at the prompt, if you don’t do this the user wont
be activated)

3) mkdir /home/jbossXXX/jboss-4.0.5.GA
(time to make some where for JBoss to live)

4) cp -r /home/jboss/jboss-4.0.5.GA/* /home/jbossXXX/jboss-4.0.5.GA
(clone the current one to a new home)

5) sudo chown -R jbossXXX:root /home/jbossXXX/jboss-4.0.5.GA
(we cloned the file rights as well so lets reset the owner to the user we just
created)

6) cp /etc/rc.d/init.d/jboss /etc/rc.d/init.d/jbossXXX
(make a copy of the existing startup script for the new instance of the server)

7) vi /etc/rc.d/init.d/jbossXXX
(edit it so we change make some changes)

8) press “I” to enter interactive mode
(bloody VI does not start in edit mode)

9) find the following lines and amend with the new server location/user

JBOSS_HOME=${JBOSS_HOME:-“/home/jbossXXX/jboss-4.0.5.GA”}
JBOSS_USER=${JBOSS_USER:-“jbossXXX”}

10) put the new notes ip address in this line

JBOSS_HOST=${JBOSS_HOST:-“192.168.0.10”}

11) Press “escape” to edit interactive mode

12) press ‘shift’+zz to save and exit

13) now normally if you have only one JBoss server, its bound to all available
IP address i.e. the same JBoss server responds to all the IP address you have
on the server, but you cant have that any more so you will have to go into the
“/etc/rc.d/init.d/jboss” and change the line

JBOSS_HOST=${JBOSS_HOST:-“0.0.0.0”}

to be the servers original IP address.

14) run the following

ln -s /etc/rc.d/init.d/jbossXXX /etc/rc3.d/S84jbossXX

ln -s /etc/rc.d/init.d/jbossXXX /etc/rc4.d/S84jbossXXX

ln -s /etc/rc.d/init.d/jbossXXX /etc/rc5.d/S84jbossXXX

ln -s /etc/rc.d/init.d/jbossXXX /etc/rc6.d/K15jbossXXX

ln -s /etc/rc.d/init.d/jbossXXX /etc/rc0.d/K15jbossXXX

ln -s /etc/rc.d/init.d/jbossXX /etc/rc1.d/K15jbossXX

(this makes links from your startup script to all the different ways that you
can start a server up (you really only need mode 3 (multi user text) and mode 6
(multi user gui), but I’m trying to be neat here.

15) bounce the box (yes yes i know you don’t have to do that, but i like to
prove that servers can cope after a power outage) reboot

and that should be your lot

Update
Now it has come to light that old versions of JBoss (seems to be below version
4.2), have a slight bug in that startup and shut down script that still putts
“localhost” as a parameter, even if you have specified an alternative IP
address, as we no longer have one server on the localhost IP address this
obviously breaks things, so while you can start up JBoss with

/etc/init.d/jbossXXX start

to shut it down (individually), you need to use something like

/home/jbossXXX/jboss-4.0.5.GA/bin/shutdown.sh -s jnp://192.168.0.10:1099

End Update

Leave a Reply

Your email address will not be published.