Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to have two instances of Tomcat 6 running on Ubuntu 10.04. I know it should be doable pretty simply by something like:

  • copy /var/lib/tomcat6 to /var/lib/tomcat6-2
  • modify ports in /var/lib/tomcat6-2/conf/server.xml
  • copy /etc/init.d/tomcat6 to /etc/init.d/tomcat6-2
  • modify /etc/init.d/tomcat6-2...

...but my problem is that I'm unsure what I should modify in /etc/init.d/tomcat6-2. Changing the NAME in the beginning of the file clearly is not enough.

(I'm aware that there is tomcat6-new-instance but I don't want to create instances for users.)

share|improve this question
    
I can't add a comment to original post, so I will just add my comment as an answer: /var/lib/tomcat-6 has sym links inside, so it is not enough to copy the directory. Anyway, I should still be missing something because even fixing the links it is trying to use configuration from original server.xml. – pakman Oct 1 '11 at 1:38
    

You can follow the directives here http://blog.tartachuc.org/2012/01/18/plusieurs-instances-de-tomcat-sur-ubuntu/

There is an ubuntu package called tomcat6-user and tomcat7-user which gives the command tomcat6-instance-create and tomcat7-instance-create with which you can create other instances of Tomcat.

share|improve this answer

I have had to do this and found the simplest solution to be this.

Give it a once over and see if this is what your after.

Running multiple tomcat by using a single catalina_base and catalina_home.

This will make it easy to manage server management to use only one tomcat setup instance

Download tomcat-6+ and unpack it. Modify two configuration files under conf:

server.xml

replace ports & access log and cluster instance name with variables like:

<Server port="${tomcat.server.port}1" shutdown="SHUTDOWN">...
<Connector port="${tomcat.server.port}2" protocol="HTTP/1.1"

connectionTimeout="20000" redirectPort="8443" />...

catalina.properties

change log file prefix like

1catalina.org.apache.juli.FileHandler.prefix = ${tomcat.server.port}.catalina

and before you run the command you should set 2 environment variables for each instance like

set JAVA_OPTS=-Dtomcat.server.port=810
set CATALINA_TMPDIR=%cd%..work810
catalina run

set JAVA_OPTS=-Dtomcat.server.port=820
set CATALINA_TMPDIR=%cd%..work820
catalina run
share|improve this answer
    
Thanks for the tip. Did you also daemonize the Tomcat instances? – tputkonen May 19 '10 at 11:35
    
Not personally, but a client of mine requested information on how to do it – admintech May 19 '10 at 13:02

if it's not too late , here is another tutorial that I wrote myself on my blog www.mycodingpains.com

I hope this helps someone :)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .