TomcatExpert

5 Scenarios and Best Practices for Running Multiple Instances of Tomcat or tc Server

posted by chanthing on October 8, 2012 05:25 AM

Tomcat supports multiple instances, and you should consider installing Tomcat so that a single binary runtime directory supports multiple instances as a means of adhering to security best practices.

While the documentation on multiple instances is in the RUNNNING.txt file at the root of the Tomcat binary distribution file hierarchy, many people aren’t necessarily aware of the feature or why you might use it. To provide some insight, let’s look at how this functionality works and provide some insight to the related best practice for security.

How it Works

To run multiple instances, two types of directories will exist:

 

1. Tomcat runtime as distributed by ASF and common to all instances – the path here is in environment variable CATALINA_HOME

2. Another directory for each individual instance – the path to the active configuration (i.e. instance) is in environment variable CATALINA_BASE

A typical CATALINA_BASE directory will contain subdirectories bin, conf, logs, webapps, work, and temp. Let’s run through the purpose of each of those directories. (Note that this document presumes Tomcat running on a Unix variant, but for Windows the techniques are analogous. For instance, substitute the suffix .bat for .sh.)

 

·bin -- Optional. When present, contains setenv.sh to set instance specific environment variables and the variant of tomcat-juli.jar you wish to use for that instance (depending on whether you want to use log4j).

·conf -- Server configuration files, including server.xml

·lib -- Libraries and classes, specific to that instance. Jar and class files here will take precedence over the same ones in CATALINA_HOME/lib.

·logs -- Log and output files.

·webapps -- Automatically loaded web applications.

·work -- Temporary working directories for web applications.

·temp -- Directory used by the JVM for temporary files.

To start up a separate instance, you set CATALINA_HOME and appropriately, along with other required environment variables, such as JAVA_HOME or JRE_HOME and then run $CATALINA_HOME/bin/startup.sh. CATALINA_HOME must be set; however, if CATALINA_BASE is not set, then the Tomcat script catalina.sh (invoked by startup.sh) sets it to the value of CATALINA_HOME.

Of course, when running multiple instances simultaneously on the same system, you have to make sure that certain configuration parameters, such as port numbers for Connectors, are unique.

One nice benefit of a separate CATALINA_BASE directory is being able to easily run Tomcat with different Java runtime arguments. You may want to run one instance with a 2GB heap, and another instance with a 256MB heap. This is accomplished by editing $CATALINA_BASE/bin/setenv.sh to set CATALINA_OPTS to the appropriate value, -Xmx2G or -Xmx256M.

In addition, there are a number of significant advantages to having separate CATALINA_HOME and CATALINA_BASE directories. For one, it makes upgrading to a new release clean and easy. All you need to do is unpack the Tomcat distribution in its own directory and then set CATALINA_HOME to this new directory before running startup.sh. (Note that this works only for point releases; the differences between major releases of Tomcat, such as 6 and 7, are too significant for this to work in most cases.) Similarly, you can simultaneously run multiple instances that use different minor versions of Tomcat.

Security Best Practices

Let’s assume the Tomcat distribution has been installed in a directory owned by root and is /usr/local/apache-tomcat-7.0.30. In a well-controlled environment, it makes sense for root (or another privileged user) to have exclusive write permission to the Tomcat install hierarchy. You don’t want random users to be able to modify the runtime used by every Tomcat instance. A consequence of this is that non-privileged users cannot run Tomcat without setting CATALINA_BASE to a suitable directory for which they have write permission. This is because a running Tomcat needs to have permission to create directories and files (e.g. exploded war files in the webapps directory, log files in the logs directory) under CATALINA_BASE. If CATALINA_BASE is not set, it defaults to CATALINA_HOME and since this directory has restricted access, non-privileged users cannot create the files and directories required for Tomcat to run.

For Tomcat, one would designate a directory, such as /var/local/tomcat, as the standard location for all CATALINA_BASE directories. This directory’s ownership, group, and permissions could be configured to allow members of a designated group, say tomcat, to create subdirectories therein. By convention, any CATALINA_BASE directory would be located there, and Tomcat would be invoked with this sequence of commands:

prompt% export CATALINA_HOME=/usr/local/apache-tomcat-7.0.30
# node1 configured with proper subdirectories: bin, conf, logs, temp, webapps, work
prompt% export CATALINA_BASE=/var/local/tomcat/node;
prompt% $CATALINA_HOME/bin/startup.sh

>> If you would like read a version of this article that also covers how these practices are embedded within VMware’s vFabric tc Server, then please check out this link.

Channing Benson has over 20 years of experience in the computer industry. Throughout his tenure he has helped customers adopt and master developing technologies, starting with  X11/Motif on Unix-based workstations, cross-Unix porting and C language optimization, and Linux development and performance tuning. While working at HP, he contributed to the FOSSology Open Source project. Channing has been a Java programmer/architect since its genesis in 1995, working primarily to help customers and independent software vendors optimize their programs for the latest available platforms, from EJBs and J2EE to Spring on lightweight containers like Tomcat and tc Server, and now cloud hosts like Cloud Foundry and high performance data grids like GemFire.

 

Comments

reply

The tips and tricks to run multiple instances in the Tomcat server shared here on the page are truly informative. I hope that these steps will be helpful to the programmers out there who are making use of Apache to test websites. In home care

And

In addition, there are a number of significant advantages to having separate CATALINA_HOME and CATALINA_BASE directories. For one, it makes upgrading to a new release clean and easy.
social signals blurb

Servers

Are there any other security problems that may encounter if more than 3 instances are running in the same time.
Thanks, papa johns coupons.

As beforehand well-known, the

As beforehand well-known, the file management.txt is the trustworthy document on how to do my essay for cheap organize Tomcat for multiple instances.

David

boom beach tipps I've proper selected to build a blog, which I hold been deficient to do for a during. Acknowledges for this inform, it's really serviceable! coc gratis juwelen

This post is very much

This post is very much informative and also useful to know how to run multiple instances of Tomcat or tc server. These five scenarios and practices are really useful to do this process. Thank you so much for sharing this post here! Man bun

I wanted to thank you for

I wanted to thank you for this great read!! I definitely loved every little bit of it. I have you book marked to check out new stuff you post…
Mortgage Broker Calgary

reply

The tips and tricks that are shared here on the site to run multiple instances of Tomcat server proved to be a really useful one to me. This post helped me a lot to understand on the working of the Tomcat servers. mesa az mobile home parks

An outstanding share! I've

An outstanding share! I've just forwarded this onto a co-worker who has been doing a little homework on this. And he in fact bought me breakfast simply because I stumbled upon it for him... lol. So allow me to reword this.... Thank YOU for the meal!! But yeah, thanx for spending time to talk about this issue here on your site.
Edmonton Mortgage Broker
Life Insurance Vancouver
Life Insurance Calgary

David

get followers app These websites are really needed, you can learn a lot. get retweets on twitter

--

cara install windows 7This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. Youve got a design here thats not too flashy, but makes a statement as big as what youre saying. Great job, indeed.jenis processor intel,cara melihat spesifikasi komputer,perangkat keras komputer dan fungsinya,cara install ulang windows 7,sejarah perkembangan dan generasi komputer

David

how to get lots of followers on twitter For many people this is important, so check out my profile: how to get favorites and retweets on twitter

amantajo

Tomcat is really a wide topic it is necessary to know many things in Tomcat. Your article shares 5 Scenarios and Best Practices for Running Multiple Instances of Tomcat or Tc Server. Thank you for providing such an informative article. how to stop snoring

I really like this type of

I really like this type of new post. You have done really good work. Your post gives us great information. HP2-K41 vce

Tomcat

For Tomcat, one would designate a directory, such as /var/local/tomcat, as the standard location for all CATALINA_BASE directories. This directory’s ownership, group, and permissions could be configured to allow members of a designated group, say tomcat, to create subdirectories therein. By convention, any CATALINA_BASE directory would be located there

I read this article. I think

I read this article. I think You put a great deal of exertion to make this article. I like your work. What is Language of Desire?

Golf course critic Sandy

Golf course critic Sandy Swingsen takes you on a tour of Florida's toughest golf shots. The Panoramic Ocean Vistas of Amelia Island Golf Courses, Jacksonville Golf Course Marsh Lands, Orlando Resort Golf Course Bunkers, Lakes, Long Carries, and other Magic. GolfShotsFlorida.com is your source to scout Florida Golf Courses before you get here. See the Golf Shots, Be the Golf Shots. See the Golf Photos, be the Golf Photos. Grand Cypress Golf Course

uje

Apa saja yang telah dirumuskan BSN mengenai besi ini aha a ha aha aha pipa hitam besi medium

In this particular article,

In this particular article, you will see a summary, satisfy browse this post. 7 steps to health and the diabetes lie review

I would recommend my profile

I would recommend my profile is important to me, I invite you to discuss this topic. youtube marketing

i like this article.

i like this article.
game
agario
happy farm game

ever says I also have such

ever says I also have such interest, you can read my profile here: davie locksmith, www.ablocksmithauto.com/davie-locksmith.html

You have shared a very

You have shared a very informative blog about the five Scenarios and Best Practices for Running the Multiple Instances of Tomcat Server. It is really very helpful for me. Very happy that you have given the details of its working in this site. best face mask

DSASDASD

jimmy choo231AS
the north face outlet
red valentino
michael kors
louis vuitton sacs
cheap jordan shoes
rolex replica watches
michael kors handbags outlet
ed hardy
jordan shoes
cheap jordans
nike blazer
ralph lauren pas cher
adidas nmd
gucci borse
fitflops shoes
nike outlet store
michael kors handbags online
nike free 5
nike roshe
converse trainers
true religion jeans sale
adidas nmd
omega watches for sale
michael kors handbags wholesale
michael kors handbags
cheap basketball shoes
longchamps
michael kors outlet
michael kors handbags wholesale
cheap nfl jerseys wholesale
instyler max 2
nike huarache trainers
ed hardy outlet
pandora charms
michael kors handbags sale
tiffany and co outlet
lebron shoes
longchamp le pliage
skechers outlet
lebron james shoes
abercrombie and fitch
michael kors handbags
michael kors handbags
michael kors handbags
nike store uk
asics shoes
pandora jewelry
michael kors handbags
nike huarache
cheap mlb jerseys
cheap ray ban sunglasses
cheap nhl jerseys
jimmy choo shoes
nike store
michael kors outlet store
nike tn
michael kors outlet
michael kors outlet
toms shoes
cheap nike shoes
michael kors handbags
michael kors outlet
yeezy boost 350 black
michael kors handbags
michael kors handbags
polo ralph lauren
toms outlet
sac longchamp
fitflops sale clearance
michael kors uk
mlb jerseys
kobe 9
michael kors uk
nike air max 90
christian louboutin outlet
cheap michael kors handbags
nike blazer pas cher
cheap michael kors handbags
saics running shoes
ecco shoes outlet
ralph lauren outlet online
michael kors handbags
nike outlet
nike trainers uk
ghd hair straighteners
new balance outlet
hugo boss outlet
supra shoes
nba jerseys
nike air huarache
ralph lauren outlet
polo ralph lauren outlet
nike blazer low
michael kors outlet store
nike trainers uk
hugo boss sale
armani exchange
fitflops
air jordan uk
cheap jordans
michael kors handbags
tiffany and co
supra shoes sale
michael kors handbags
dolce and gabbana
cheap nike shoes sale
new balance shoes
nike air force 1
michael kors handbags wholesale
omega watches
nike trainers
gucci sito ufficiale
michael kors outlet online
salomon boots
armani exchange outlet
michael kors handbags
yeezy boost 350
christian louboutin shoes
nike huarache
instyler max
nike tn pas cher
valentino shoes
nike trainers
ed hardy clothing
under armour outlet
michael kors handbags
fitflops sale clearance
nike free
michael kors handbags
michael kors handbags
cheap oakley sunglasses
oakley sunglasses
salomon shoes
cheap oakley sunglasses
oakley sunglasses
ghd flat iron
michael kors handbags
the north face
chaussure louboutin
cheap oakley sunglasses
michael kors handbags
pandora outlet
michael kors handbags
salvatore ferragamo
moncler outlet
converse shoes
nike blazer pas cher
true religion jeans
adidas nmd r1
louis vuitton pas cher
ray ban sunglasses
jordan shoes
mont blanc pens
michael kors handbags wholesale
replica watches
ecco shoes
ralph lauren
ray ban sunglasses
michael kors handbags outlet
abercrombie and fitch kids
michael kors handbags clearance
cheap ray bans
longchamp bags
oakley sunglasses
versace
ed hardy uk
pandora jewelry
mont blanc pens outlet
cheap nfl jerseys
michael kors outlet
dolce and gabbana shoes
basketball shoes
nike huarache
michael kors outlet
nike air huarache
michael kors outlet
versace shoes
air force 1 shoes
cheap michael kors handbags
michael kors handbags outlet
michael kors outlet
cheap nba jerseys
under armour shoes
ferragamo shoes
adidas nmd runner
michael kors handbags
nike blazer
reebok shoes
michael kors handbags wholesale
skechers shoes
chaussure louboutin pas cher
dolce and gabbana outlet
michael kors handbags
michael kors outlet online
cheap michael kors handbags
birkenstock sandals
air max 90
michael kors outlet clearance
birkenstocks
nike roshe run
yeezy boost 350 white
reebok outlet
moncler jackets
michael kors handbags sale
kobe 9 elite
nhl jerseys
michael kors handbags
michael kors outlet

http://www.fabrikasikonstruksi.com/

ad adc a aad pabrik besi beton pabrik besi beton
pabrik besi beton ais pabrik besi beton ais
pabrik besi beton Sni Ulir Polos pabrik besi beton Sni Ulir Polos
pabrik besi beton bjku pabrik besi beton bjku
pabrik besi beton cakra steel cs pabrik besi beton cakra steel cs
pabrik besi beton delcoprima pabrik besi beton delcoprima
pabrik besi beton gunung garuda pabrik besi beton gunung garuda
pabrik besi beton interworld steel is pabrik besi beton interworld steel is
pabrik besi beton jcac pabrik besi beton jcac
pabrik besi beton krakatau steel pabrik besi beton krakatau steel
pabrik besi beton ksty pabrik besi beton ksty
pabrik besi beton master steel ms pabrik besi beton master steel ms
pabrik besi beton PAS pabrik besi beton PAS
pabrik besi beton perwira pabrik besi beton perwira
pabrik besi beton psi Ulir Polos pabrik besi beton psi Ulir Polos
pabrik besi beton sii pabrik besi beton sii
pabrik besi beton Sni Ulir Polos polos ulir pabrik besi beton Sni Ulir Polos polos ulir
www.pabrikbesibajamurah.com www.pabrikbesibajamurah.com
www.pusatbesibaja.com www.pusatbesibaja.com
www.pusatbesibaja.co.id www.pusatbesibaja.co.id
jasa konstruksi baja jasa konstruksi baja
undangan pernikahan undangan pernikahan
jasa konstruksi jual laptop asus
jasa konstruksi baja jasa konstruksi baja wf
jasa konstruksi gudang jasa konstruksi jembatan
jasa konstruksi gedung jasa konstruksi bangunan
www.husnialbardani.com www.husnialbardani.com
jual laptop asus murah jual laptop asus murah

www.sentrabesibaja.com Daftar pabrik Besi Hollow Dari pabrik Pabrik
pabrik Besi Beton Daftar pabrik Besi Pipa Baja Schedule 40 Dari pabrik Pabrik
pabrik Besi H beam Daftar pabrik Besi H beam Yang Dipabrik Dari Pabrik Ke Agen
pabrik Besi Wf Info pabrik Welded Beam T beam King Queen Cross Castellated Beam
pabrik Pipa Besi Hitam Medium Daftar pabrik Bondek Cor Ter Murah pabrik Pabrik
pabrik Besi Pipa Baja Schedule 40 sentra besi baja
pabrik Besi Pipa Baja Schedule 80 Daftar pabrik Besi Unp Baja Profil Kanal pabrik Pabrik
pabrik Wiremesh Daftar pabrik Besi Pipa Baja Schedule 80 Dari pabrik Pabrik
pabrik Besi Hollow Daftar pabrik Plat Kapal Dari Pabrik Ke pabrik
pabrik Besi Cnp Profil Baja Gording Daftar pabrik Atap Spandek Sni Dari Supplier Pabrik
pabrik Besi Unp Baja Profil Kanal Daftar pabrik Plat Besi Hitam Dari Supplier Pabrik
pabrik pabrik Besi Siku Baja Daftar pabrik pabrik Besi Siku Baja Dari Supplier Pabrik
pabrik Plat Kapal Bki Krakatau Steel Daftar pabrik Pipa Besi Hitam Medium Dari Agen Pabrik
pabrik Plat Besi Hitam Daftar pabrik Wiremesh Yang Dipabrik Dari Pabrik Ke Supplier
pabrik Plat Bordes Kembang Daftar pabrik Besi Wf Dipabrik Dari Pabrik Lewat Supplier
pabrik Atap Spandek Sni Daftar pabrik Plat Bordes Kembang Dari pabrik Pabrik
pabrik Bondek Cor Daftar pabrik Besi Beton Yang Di pabrik Dari Pabrik Ke pabrik
pabrik Welded Beam T beam King Queen Cross Castellated Beam Daftar pabrik Besi Cnp Profil Baja Gording Supplier Pabrik
jasa konstruksi fs jual laptop asus
jasa konstruksi baja jasa konstruksi baja wf
jasa konstruksi gudang jasa konstruksi jembatan
jasa konstruksi gedung jasa konstruksi bangunan
a

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.