Sep 172007
 

I’m spent about 6 hours total working on getting multiple instance of Tomcat to run on Ubuntu and finally wrote some scripts that I’d like to share with folks. These scripts do the following:

1. Setup the box to host multiple instances (JVMs) running tomcat

This process cleans the old layout and sets up a new layout that allows for multiple instances. This includes a number of “instances” directories in /var/lib/tomcat5.5, /etc/defaults/tomat5.5 (a new directory) and /var/log/tomcat5.5.

2. Create new instances

This allows you to setup a new instance quickly. It creates all the necessary directories and also installs the new instance into the init scripts an run levels.

Things the scripts don’t do:

– Setup multiple mod_jk configurations and apache virtual hosts
– Any SSL or security management

Here’s how to use the scripts:

1. First make sure you have Java and Tomcat installed!

2. Grab ALL of the scripts and place them in some directory (anywhere is fine)

3. Run the multiple-instances.sh script as root from the directory you put it in

4. Run the new-instance.sh script to create a new instance

5. Configure the new server by editing the files in /var/lib/tomcat5.5/instances/<instance-name> (mainly conf/server.xml)

6. Make sure each instance has a unique port for everything including the AJP, all listeners and the container

7. Fire it up!

8. Check the logs in /var/log/tomcat5.5/instances/<instance-name>/catalina.out

Due to security considerations, I’ve included the scripts inline. Any comments are welcome:

multiple-instances.sh

new-instance.sh

tomcat.sh

  45 Responses to “Multiple Tomcat instances on Ubuntu”

  1. Great scripts, thanks. Found one small error in multiple-instances.sh:

    # Clean up defaults for the template script
    cd /etc/defaults/

    Should be /etc/default.

    . m

  2. Nice catch. Updated the post to include your fix.

  3. These are great. I would have had to spend more than 6 hours creating the same thing.

    I only had issues with copying from the web. Maybe its just me but I get bad “, ‘, and ` characters. I also get line breaks so a continuation character ( \ ) would be useful. Downloadable scripts could fix these issues but I’m not concerned with the security issues.

  4. Dear Sir,

    That’s good you have access two instances on same machine of tomcat, but you access them on Linux or I think SUSE, but I have problem to access two liferay tomcat on same machine, I have changed port & java_home in server.xml & catalina.bat. Should I need to change another files too for it.

  5. Nice scripts, thanks :)
    Could you provide a download link though? As mentioned your blog is adding bad characters and stripping the line continuation characters.

  6. I created a Google code project and open sourced these scripts. Figured it was easier this way. Here’s the place for these scripts:

    http://code.google.com/p/debian-tomcat-scripts/

    You can check them out from SubVersion or browse them via the web.

  7. Are these scripts accurate as written for ubuntu 8.x and tomcat5.5?

    Jack

  8. Jack,

    I’d recommend checking out the latest work I’ve done on Tomcat on Linux. I posted a DEB for running multiple instances of Tomcat 6 on Linux and it completely replaces the standard Tomcat. It also cleans up many of the messes that Debian has created with their package and is a 100% valid Tomcat installation.

    Here’s the post from the Ubuntu Forums on it:

    http://ubuntuforums.org/showthread.php?t=1211517

    I’ll put up another blog post here about it as well.

  9. Hi Brian,

    Your scripts are using the older JK workers style to connect apache to tomcat. With Apache 2.2, you can also use the (easier) mod_proxy_ajp.
    Is it a good suggestion if you update your scripts to this?

    Marcel

  10. Marcel,

    If you want to join the project I’ve setup, it is located here:

    http://code.google.com/p/debian-tomcat-scripts/

    That project can create DEB packages and contains some more advanced scripts. Eventually I’d like to start publishing the DEBs into a valid APT repo. These scripts are also using Tomcat 6.0.x and can certainly use Apache 2.2 and mod_proxy_ajp.

    Let me know if you want to help on that project.

  11. Hi Brain,

    I can see if i can help you with that :)… though my DEB knowledge is newby!

    Some ideas:
    – would be great to have the possibility to turn a manual instance into a init.d’ed instance and vice versa
    – how about a t6eninstance and t6disinstance command (like a2ensite and a2dissite) which places symlinks from instances-available to a instances-enabled folder. That way, init.d/tomcat6instances can take one argument (stop/start/restart) and does that on all instances.. or takes two arguments, where 2nd is the instance name from the dir “instances-enabled”

  12. Perhaps. The main difference here is that Apache is a single process where the way I have Tomcat setup is that each instance is a separate process. This was intentional in order to prevent one webapp from crashing others.

    Any solution would need the ability to control single instances in cases of failures where a single instance needs to be restarted.

  13. Nice work!!!
    And this makes me think!!!
    What if we want to run two different versions of tomcat on the same server, say 5x and 6x.
    How could we manage that in case we have two different applications that one can run only with 5x and the other only with 6x?

  14. That should work fine. You just need to ensure you can install both the 5.5. and 6.0 packages at the same time. This should be possible on most Linux varieties.

  15. It’s the best time to make a few plans for the long run and it is time to be happy. I have read this submit and if I could I desire to suggest you some attention-grabbing issues or advice. Perhaps you can write subsequent articles relating to this article. I desire to read more issues approximately it!

  16. Pretty section of content. I simply stumbled upon your website and in accession capital to say that I acquire in fact enjoyed account your weblog posts. Any way I will be subscribing in your feeds or even I achievement you access constantly fast.

  17. I have written a Java based portable utility for automating the above steps for creating multiple instances. Since Java is platform independent, this utility works on all operating systems

  18. […] some advanced scripting, which is dangerous in a production […]

  19. […] some advanced scripting, which is dangerous in a production […]

  20. While there is nothing you can do about that, you can have
    some extra clothing just in case.

    Feel free to surf to my weblog … water bottle survival kit,
    Isabell,

  21. My partner and I stumbled over here from a different web page and thought I might as well check things out.
    I like what I see so now i’m following you. Look forward
    to checking out your web page yet again.

    my web page real Estate lawyer chicago

  22. Hi there! I cοuld haνе sworn Ӏ’ᴠе visited
    thiѕ blog before ƅut ɑfter
    ցoing through ѕome οf tɦᥱ
    articles Ⅰ realized іt’s neᴡ tߋ mе.

    Nonetheless, I’m ϲertainly ɦappy ӏ stumbled սpon іt and Ⅰ’ll ƅᥱ bookmarking it
    and checking back frequently!

  23. […] some advanced scripting, which is dangerous in a production […]

  24. Finally, our testers liked how this collection presents an awesome stability of mastering and enjoyable,
    and encourages curiosity in research, desktops,
    and engineering. For example, curriculum in robots often involves monsters that explode or
    cars that go fast. The coolest part is playing with your robot once it’s built and programmed.

  25. This is a very good tip particularly to those fresh to the blogosphere. Short but very accurate information… Many thanks for sharing this one. A must read article!

  26. bookmarked!!, I love your website!

  27. A lot so, that oftentimes I’ll just throw out travel author” or professional photographer” to avoid a really prolonged conversation.

  28. A long list of subscribers on your web site is a sign of the variety of possible customers you have.
    But ways to you get individuals to register and be part of your subscribers’ list?

    Remember that people surg the Internet searching for reputable
    details. They will want to be updated too if your web site provides them accurate and fresh truths on a regular basis.
    So, they’ll leave their email addresses so
    you can send updates in the mail, which will lead them to check out and review
    your site. How do you provide the information? Attempt an e-zine, e-books, short articles or newsletters.The basis for these marketing
    benefit chances is something called authorization marketing.
    Fairly merely, permission advertising indicates that before a marketer
    pounds you with his message, he has to first ask you nicely and state please.

    When he gets your permission, and just then, he can play his advertisement.
    Since you’re most likely not going to consent without getting something out
    of it, the advertiser will provide you some sort of reward for seeing the advertisement.

    You get the benefit and the advertiser gets his message out.
    Everyone is delighted. Almost what it comes down to is that
    you as the marketing consumer get a small cut of the advertising income.Both short and long term loans are on the offer.
    Long term loans are basically for carrying out long-term strategies of a company.
    They are, by nature, buoyed up by not having extremely precise payment provisions.
    Nor are they handicapped by having pay-by-date. Wait up
    until your company sees a considerable enhancement and afterwards start paying.
    Only do not take all your life. Small businesses can take the loans to take care of short-term
    uses and pay back whenever there is cash enough to pay back.So just like
    any industry there are some serious growing discomforts within the field of tattoos as the standard tattoo
    artists and those more recent to the field battle with concerns of marketing in illinois (Liliana) vs.
    art. Many feel that this brand-new growth is wonderful
    and it is all resulting in new business and more respect for the field.
    Nevertheless the standard tattoo artists
    feel that their real art and life style is now being exploited and commercialized.Let your sale be known. advertising has always been the utmost tool for
    product awareness. Time has proven its efficiency. However, when you advertise, do not stay with one medium.
    It is finest that you use everything readily available, especially when it is free.
    Distribute text, advertise on online classified advertisements, send emails, post indications and many others.
    Comprehensive advertising permits you to send your message to your possible purchasers; no matter what part of the
    nation they are in.Keep in mind, Viral internet marketing Videos are unpredictable.but that’s part of what makes them so effective!

    Take the Old Spice Commercial for example.that went Viral
    on YouTube and on Facebook! And why ?? Because it
    was hilarious and original!! So the typical motif will generally either
    be smart creativity, humor or both! Originality that is based upon the current
    pop culture– exactly what is big and popular RIGHT
    NOW! Or that is just so creative and clever that it will then just
    BECOME our popular culture!!That is why if you prepare to
    sell your homes at challenging times, you need
    to use all tricks in the book to close the sale. It is a challenging competitors out there.
    However, if you play your cards right you can get an opportunity to score some
    terrific deals.The most interesting idea that concerns my mind (the “numbers person” mindset is kicking in),
    is this: at exactly what point in the time-line will I have to discover another world and coincident population to
    market to in order to grow my already geometrically huge team?
    I don’t believe the 6 billion or so individuals currently readily available is going to suffice.

  29. You should take part in a contest for one of the highest quality websites on the internet. I’m going to recommend this site!

  30. The ERP software reduces the error in the working of the system.

    In addition, it helps to streamline operations by eliminating redundant and time-consuming work tasks.
    The ERP software can work well for established businesses that have defined practices and processes, but an ERP can be very inflexible for businesses that are looking to significantly change what it is that
    they do.

  31. This blog was… how do I say it? Relevant!! Finally I’ve found something which helped me. Many thanks!

  32. Excellent post. I will be facing many of these issues as well..

  33. What i don’t understood is in truth how you are now not actually
    much more smartly-preferred than you may be now.
    You are so intelligent. You realize thus significantly with
    regards to this topic, made me in my view consider it from a lot of numerous angles.
    Its like men and women don’t seem to be involved except it’s something to
    accomplish with Lady gaga! Your individual stuffs nice.
    At all times take care of it up!

    my website – chicago closing Attorney

  34. Another method to speed up the healing procedure of herpes blisters is to
    apply some tea tree oil to the contaminated location two times daily.

  35. Genital herpes normally triggers several break outs (four or 5) within a year of the very first outbreak, with fewer and
    less extreme break outs gradually.

  36. ???????????????????????????????? ???????????????????????????? [url=http://yaplog.jp/bestkeyjp/archive/2]windows10[/url]
    ?????????????16???????? ????nicozon?????????????????????????
    [url=http://key4soft.fukuokablog.jp/e10022.html]win7 pro[/url] ???????Lync Server ????????????????????????????? ???????????????? Web ??????????????????????????????????? ?????????????????????????????
    [url=http://yaplog.jp/bestkeyjp/archive/2]windows10 ??[/url]
    ?????IS3?#7??160y?????????? C. ???????? ?????????? [url=http://godbestsoft.blogspot.jp/2016/07/windows-os.html]office ???????[/url]
    ?????????????????????????????? ??????????????????????——————————————–??????????????
    [url=http://key4soft.fukuokablog.jp/e10022.html]windows7 pro[/url] JPshiken?Microsoft?70-347?????????????????????????? Windows Live Mail 2012???????????
    [url=http://genuinekeyonline.junglekouen.com/e861771.html]windows 10 ??[/url]

  37. ??????????????????????????????????? ???????????????????????? [url=http://bestkeyjp2.hamazo.tv/e6945735.html]office 2013 ??????[/url]
    ??????????????????????????????????????????? ??????????????????????????????????????????????????
    [url=http://blog.eigyo.co.jp/windowspeedup/article/248682]windows 8.1 ?????[/url] ???????????????????????????????????? Microsoft Office 2007 suites (KB3114742) ???????????????
    [url=http://windowspeedup.n-da.jp/e697848.html]office 2013 ?????[/url]
    ???????????????????????????????????????????????????????????????????????????????????????????????? ?????? ???????????? ????Windows10????????????????????????????? [url=http://windowspeedu.blog.wox.cc/entry1.html]windows7 pro[/url]
    http://ichigojam.net/farm.html?for PC ???????????????????????????????????????????????????????????? ???????JN0-1100?????????????????97????????????????????
    [url=http://windowspeedu.blog.wox.cc/entry1.html]windows7 ??[/url] ????4GB?????????????????????????????? ????????????????????????????IT?????????Pass4Test?SAP?C-HANAIMP142?????????????
    [url=http://windowspeedup.n-da.jp/e697848.html]office 2013 ??[/url]

  38. Now do not panic. Over the counter cold sore solutions can be pricey
    and the majority of are actually palliative in nature.
    The signs include blisters or ulcers on the affected part of the skin, and sometimes
    flu-like signs, however a reasonably little percentage
    of individuals experience these. I have always said it
    times without number that Staph infection spreads through the blood stream, that is
    why the impact is felt on every part of the body system, when it
    spreads to the joints and bones particularly those of the arms, legs and spinal column it forms abscesses.
    When a sore is present, a person needs to be evaluated for HSV-2.
    The standards also include ways for physicians to discriminate between virus-caused sinus infections and bacteria-caused sinus infections.
    By the age of 15 years, more than 70% of teenagers are infected by the HSV-1.
    Symptoms of herpes are marked by clusters of small, painful
    blisters and sores on the lips, or genitals.

    Coping with herpes is a simple affair frequently made a lot more made complex by
    stress, negligence, anxiety, and tiredness.), and infections appropriate to possible bioterrorism (Ebola, smallpox, Turmeric is an aromatic, slightly bitter, yellow powder
    that is acquired by boiling, drying and crushing the roots and rhizomes of the
    perennial Curcuma longa plant belonging to southern Asia.
    Thanks to all of this confusion, regrettably, unusual misdiagnoses of herpes do occur.

    What looks to be herpes isn’t really constantly herpes: Our own Shannon Coffey described in an episode of Report Card
    on RIOT that she at first received a visual diagnosis of herpes.
    With the other germs still so strange, Olsen said he was persuaded there was more to the story.
    National Health and Nutrition Examination Study.
    Reduce quantity of tablets taken until these symptoms disappear.
    If these signs are really serious, stop taking tablets until symptoms disappear, which can be anywhere from one day to a week.
    And this time I’ll likely be on some kind of
    chemo drug for the rest of my life or till there’s a cure.
    The idea of this both exhausts and frightens me. I do not wish to pass away.
    My daughter just turned 2. I wish to be around to see her mature.

    I want to age with my hubby. I’m not ready to go anytime quickly …
    not by a long shot. ) or telaprevir (Incivek in Do not exceed 4
    tablets a day. Also, screening is seldom done if clients are treated for their signs.
    An estimated 2,291,000 non-institutionalized U.S. civilians ages 14-39 are infected with C.

    trachomatis based upon Olsen focused his research– after poring over
    hundreds of other evaluations– on some of the lesser-known germs types
    that make up the oral microbiome. You may want to
    take an anti-viral medication as genital herpes
    treatments. Someone you understand most likely has herpes.
    ), natural emerging infections (avian and swine influenza pressures, SARS,
    The open fever blister would be painful enough, but it is much more so due to the fact that the herpes virus produces the cold sore right on completion of that
    nerve fiber. Fortunately is that with some efforts, you can be asymptomatic (no outbreaks).

    Suppression of the signs is the closest you’ll ever be to a ‘remedy’.
    Today the plan is for me to resume chemotherapy after the
    first of the year.

  39. The most essential thing is forget about your stupid, absolutely incorrect idea that your sweetheart must discover
    who you are on your very first date.

  40. Os casais começam tratamento com expectativas positivas de
    sucesso, mas quando ocorre fracasso surgem as tristezas, decepção e perda pela
    vontade de realizar seu sonho de ser pais, começam associar
    fracasso, sofrimento físico, os homens lembra da coleta do sêmen como uma experiência
    estressante e a sua única participação no processo da fertilização in vitro6.

  41. Especialmente a partir de 1985, definido pela Organização das
    Nações Unidas (ONU) como Ano Internacional da
    Juventude, inúmeras iniciativas foram desencadeadas em todo mundo,
    visando levantamento das necessidades sociais dos jovens que viriam a constituir as futuras gerações
    de adultos no terceiro milênio.

  42. With work, household, buddies, social obligations you may
    find yourself to have hardly any time delegated be with your sweetheart.

  43. Rather than an individual type of solar cell technology, building integrated photovoltaics have several subtypes (or different methods of integration), which can be
    based on both crystalline-based and thin-film solar cells.

  44. I gotta bookmark this web site it seems very useful
    extremely helpful.

  45. Champion Davis, Canada’s flamboyant Olympic gold-medal swimmer, died Monday from injuries incurred Saturday in an accident that Montreal protect stillness are upsetting to unravel.
    Davis, 25, was pronounced categorical at 11 a.m. PST, said Jacques Charbonneau, a spokesman owing Notre Dame Sickbay in Montreal.
    Doctors gave Davis toy chance of surviving after misery a glowering skull fracture, perspicacity and spinal mutilation and multiple bruises from being discern not later than a car.
    http://vangoghartist.livejournal.com/

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">