Go Vegetarian

Go Vegetarian

Friday, August 22, 2008

CATALINA_BASE and CATALINA_HOME

Let's say you would like to start several Tomcat instances on the same server.

In this case you have several possibilities.

1) You are not worried to duplicate the binaries and it is the way most of us do at the beginning.

You copy/paste the directory Tomcat on some other place. Every instance will have it's own CATALINA_HOME directory. Easy to do. But you waste the binaries.

2) You don't want to waste disk space and you start to play with CATALINA_BASE.

CATALINA_BASE is the location where you will put the configuration, logs, ... of your new instance.
More precisely, conf, logs, shared, temp, web apps and work.

You'll have to assign 2 variables this time : CATALINA_BASE and
CATALINA_HOME. In point 1) you only assign 1 variable : CATALINA_HOME.

Is it clear enough ? Maybe not ? So let's show you an example.

On the same server, there are 2 users, rudy and user1. The users, rudy and users1 both would like to manage theirs own Tomcat instance but the Administrator of the server did not allow to duplicate the software/binaries.

rudy has /export/home/rudy as homedir
rudy decided /export/home/rudy/tomcat as CATALINA_BASE

user1 has /export/home/user1 as homedir
rudy decided /export/home/user1/tomcat as CATALINA_BASE

/opt/tomcat is CATALINA_HOME

root has to
cd /opt/tomcat
copy conf, logs, shared, temp, webapps and work
to /export/home/rudy/tomcat
and to /export/home/user1/tomcat
and of course change the ownership of the files to rudy and user1.

Now, Rudy and User1 can both start theirs own instances of Tomcat. The instances share the binaries located in /opt/tomcat but each instance has its own configuration in $CATALINA_BASE/conf.

Of course, you have to modify server.xml(both users) to avoid to use the same ports, ip addresses. Otherwise Tomcat will not start.

-rudy-

No comments: