Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CB392E6AD for ; Wed, 6 Feb 2013 16:21:42 +0000 (UTC) Received: (qmail 35539 invoked by uid 500); 6 Feb 2013 16:21:39 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 35388 invoked by uid 500); 6 Feb 2013 16:21:39 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 35379 invoked by uid 99); 6 Feb 2013 16:21:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Feb 2013 16:21:39 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [98.139.213.149] (HELO nm28-vm0.bullet.mail.bf1.yahoo.com) (98.139.213.149) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Feb 2013 16:21:30 +0000 Received: from [98.139.212.152] by nm28.bullet.mail.bf1.yahoo.com with NNFMP; 06 Feb 2013 16:21:09 -0000 Received: from [98.139.211.195] by tm9.bullet.mail.bf1.yahoo.com with NNFMP; 06 Feb 2013 16:21:09 -0000 Received: from [127.0.0.1] by smtp204.mail.bf1.yahoo.com with NNFMP; 06 Feb 2013 16:21:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1360167669; bh=9zcpkJoyYqA6cQ8SHhx35Vkbji5VLlPMj9Vu36/DlXo=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=DcsV3sECQiFxRWVB2jRkczBQWxKohC+nwxeJ5jd4N2iml9Y0z2UDK8Dys9/VxCop2gt4mUmVcNHzD1clq4LGIAqlpo9u2osrxGvRCjOidKKKbsCqcv3UWT1IQItOAW9It4p11IDIlKiRBcOEfGYk0wlhOlT/GV4mj6LwsTJBjmM= X-Yahoo-Newman-Id: 394565.67243.bm@smtp204.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: ixOM_GkVM1kTeJeUc0k_2.VL6dLrGa.XR7vm1hziUAQWGWQ CSqwfd3F0Il.nPi734nsU.R0wkLs_ihuG38OiHrwtnG4sI8Xgt45oQygyu_y J8_ouEFBInKRxzyZyGIrYPs_qISBK2uE7PZE7Cs88TgRM9hZFygXskgnaJFj MK6j4W7sI4s5RsRVX_FOtiYmIwjTTN6U9JH.GNnV9X0TZHd_29NyxkFkmtsv 68TB_AQTo_KtSi8w4xlPXh._xVA2DTuWib_rCJiodncSJhmywMjPbYgv.UDP iap..0adeOD0kkRnZwrVnMjLQLbRJbya9LP9qEEYNI5sPtsxwwMj7xzpzfD. OXh7P5RzlFkb3k.wd_KWem50ELDN6bTUucm9ZSSPBW92shzZE24u0f0Egbtp cEDJ1be59T__s0Des79CkL28tXOCSLg9A8X7VK0TR6pJs8RGADF_Y90m_NqW GiXjx86JnzqvnM2b89GA0wwNsBneycFKm4Kyvh.YwMzeZXl_gLRulF582nDf gXOEep1NS0w-- X-Yahoo-SMTP: PKuT8k2swBCeFOHzkGy5rTOUTa2hBxlR Received: from [127.0.0.1] (its_toasted@76.175.11.19 with plain) by smtp204.mail.bf1.yahoo.com with SMTP; 06 Feb 2013 08:21:09 -0800 PST Message-ID: <511282D3.20806@yahoo.com> Date: Wed, 06 Feb 2013 08:20:35 -0800 From: Mark Eggers User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: users@tomcat.apache.org Subject: Re: Tomcat References: <20772781D66D884CBAFFABECDC5A9A8D3BBE83FD65@LONMC01010.rbsres07.net> <51122989.4030801@ice-sa.com> <20772781D66D884CBAFFABECDC5A9A8D3BBE83FE87@LONMC01010.rbsres07.net> <51123595.4050908@ice-sa.com> <20772781D66D884CBAFFABECDC5A9A8D3BBE9483DA@LONMC01010.rbsres07.net> In-Reply-To: <20772781D66D884CBAFFABECDC5A9A8D3BBE9483DA@LONMC01010.rbsres07.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org On 2/6/2013 3:20 AM, Mohit.Garg@rbs.com wrote: > > Hi Thanks for all the help and I know it may sound lame but I am > trying to learn these things. Although I have one more doubt. If we > have multiple tomcat for multiple environment on the single Unix > box(machine) Now Single Apache daemon is running for multiple > environment. So can we run multiple instance of Apache daemon in the > same machine or not for each different environment. If this is > possible how can we accomplish this. > > Thanks in advance for the help and sorry for bugging the group with > such silly questions. > > MOHIT GARG Analyst International Banking RBS Block No 1, Tower A, > Unitech Infospace Complex Sector 21, Gurgaon, Haryana, 122002, India > Office: +91 8860190177 > > -----Original Message----- From: Andr� Warnier > [mailto:aw@ice-sa.com] Sent: 06 February 2013 16:21 To: Tomcat Users > List Subject: Re: Tomcat > > Mohit.Garg@rbs.com wrote: >> Hi >> >> Regrets for the wrong framing of question. Actually I am new to >> tomcat and what I really want to do is run on the same server two >> different tomcats so that one doesn't interfere with the working of >> the other. As I have different environments so I want that the >> tomcat running in my development environment do not access the >> files of my SIT environment and vice-versa. That's why I want to >> have a separate tomcat process for each host. If I just change the >> port in the config file the request will be mapped but the various >> environments will have access to all the files as it will be >> present in the common directory. >> > > Ah, that's better. So we forget about Apache httpd, right ? So, > assuming that you are talking about tomcat only : > > There are (many) different levels of separation, depending on what > you really want to separate. > > First, a note : considering that you are on a Linux machine, it is > highly possible that you have installed Tomcat using a pre-packaged > version from your Linux distribution. These packages work fine and > are easy to install for a normal single-instance case, but they make > it more difficult for doing the kind of thing that you want to do, > and more difficult for people on this list to help you. That is > because each of these packages distributes the files of Tomcat in > different places on the disk, sets different environment variables, > sets differents links from one directory to the other in the > filesystem, etc.. So it would be better to install a "standard" > tomcat downloaded from the website "tomcat.apache.org", to some > directory like /opt/tomcat, and follow the instructions that are > given in the "RUNNING.txt" file at the top of this distribution. This > way, everyone here knows what you are talking about and has a good > idea of where things are. (You can also leave your current Tomcat > where it is, and consider it as your "production" tomcat, and > download and install another copy to another directory as your > "development" tomcat. Then we can maybe help you set up this > development tomcat in a way that does not conflict with the other > one). > > Then, the next question is : you want to run 2 "separate" tomcats, so > as not to mix the production and the development environments. That's > established. But do you want also to be able to run 2 different > /versions/ of Tomcat ? > > If yes, you will have to download and install tomcat twice, to 2 > separate directories in /opt (such as /opt/tomcat-prod and > /opt/tomcat-dev for instance). If not, then one single copy of tomcat > will be enough, and you can configure things to still run 2 different > "instances" of tomcat, from one single copy of the code. > > > Then, some advance information : There are 2 environment variables > which point to disk directories and which are very important for what > you want to do : > > CATALINA_HOME : this tells Tomcat where its runnable *code* is > located. under CATALINA_HOME, Tomcat expects to find for example > it's "bin" subdirectory, where the main executable parts of Tomcat > are located. > > CATALINA_BASE : this tells Tomcat where its instance-specific > "things" are located. For example, Tomcat will look into > $CATALINA_BASE/conf to find its main configuration files. > > By default, these 2 values are the same, and Tomcat will use the same > /bin, /conf etc.. > > But you can set up 2 tomcat instances to use the same $CATALINA_HOME > directory (so they will run the same Tomcat code from > $CATALINA_HOME/bin), but have different $CATALINA_BASE directories > (so they will use a different configuration from $CATALINA_BASE/conf, > different webapps from $CATALINA_BASE/webapps etc). > > That's the basics for separating two tomcat instances. > > Note that there is still a much easier way, using a single Tomcat > instance and just 2 separate "virtual hosts" inside the same running > Tomcat (see : > http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html). > The hostnames will be different, and the webapps will be completely > separate. But there will still be one single instance of tomcat > running, and there /could/ be interference between them (not at the > access level, but in the sense that one webapp could use up all the > memory and so interfere with the other e.g.). > +1 for all tha Andr� has said. (Mark-like novella typing detected above :p) Anyway, what we do is the following: 1. One Apache HTTPD This runs named virtual hosts and IP-based virtual hosts (see the Apache HTTPD docs and the Apache HTTPD mailing list) 2. mod_jk between Apache HTTPD and multiple Tomcats 2a. Each Tomcat gets its own worker.properties configuration See http://tomcat.apache.org/connectors-doc/reference/workers.html for details. There are great examples in the recent mod_jk source bundle. 2b. Each named virtual host gets its own uriworkermap.properties file See http://tomcat.apache.org/connectors-doc/reference/uriworkermap.html for details. There are great examples in the recent mod_jk source bundle. 3. Tomcat configuration 3a. Make sure that each Tomcat has a element that corresponds to each Apache named virtual host (or IP-based virtual host) that it's responsible for. 3b. Make sure that the ports are different for each Tomcat. (Shutdown port, AJP port, any HTTP/1.1 ports) 4. Run each Tomcat as a separate service We use a separate start-up script for each. Each start-up script reads from a configuration file that has CATALINA_HOME, CATALINA_BASE, and JRE_HOME defined. This means we can run different JVMs for different Tomcats, and upgrade each Tomcat separately. 5. As Andr� pointed out, run a stock Tomcat from tomcat.apache.org 6. Run all of the Tomcats from an unprivileged account We make the account only accessible via su, control access, and monitor its use. This makes auditing much easier. I'm sure there is more, but this is quite long enough as it is. . . . . just my two cents. /mde/ --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org