geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Geronimo v3.0 > Running multiple Geronimo instances
Date Thu, 01 Mar 2012 18:15:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/4/_/styles/combined.css?spaceKey=GMOxDOC30&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Running+multiple+Geronimo+instances">Running
multiple Geronimo instances</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~rglaue">Russell
E Glaue</a>
    </h4>
        <div id="versionComment">
        <b>Comment:</b>
        Update to explain GERONIMO_SERVER, and how to use GERONIMO_SERVER, plus explanation
of the shared vs local repositories.<br />
    </div>
        <br/>
                         <h4>Changes (42)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{note} <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">Regarding
both Geronimo javaee6 and minimal release bundles. While it is certain that multiple installations
can safely run side-by-side by completely copying the server folder to another, and start
a 2nd instance after changing its portOffset value, we are undergoing final work for safely
running multiple instances within a single installation. Follow [GERONIMO-6270|https://issues.apache.org/jira/browse/GERONIMO-6270]
and its sub-tasks for details on the progress. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Regarding
both Geronimo javaee6 and minimal release bundles. Full support for multiple instances was
completed in [GERONIMO-6270|https://issues.apache.org/jira/browse/GERONIMO-6270] and its sub-tasks.
This support is available in the latest snapshots after March 1, 2012, and will be in the
3.0-beta-2 standard release. This documents how to run multiple instances after applying the
changes from GERONIMO-6270. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">The
startup scripts provided in this documentation provide the proper startup procedures for multiple
instances in a safe manner, even though run-rime safety is still being investigated. Each
Geronimo instance should ideally have a second repository for itself in oder to keep deployments
from interfering with each other. See [Configuring multiple Repositories]. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">For
prior releases, multiple installations can safely run side-by-side by completely copying the
server folder to another, and start the 2nd server installation after changing its portOffset
value. <br></td></tr>
            <tr><td class="diff-unchanged" >{note} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h1.
{{GERONIMO_HOME}} versus {{GERONIMO_SERVER}} <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Simply
put, {{GERONIMO_HOME}} is the path to the server binary installation and {{GERONIMO_SERVER}}
is the path to the server run-time configuration. {{GERONIMO_HOME}} is the path to where Geronimo
was installed which every instance references, and every Geronimo instance defines its own
{{GERONIMO_SERVER}} as the path to the configuration for the instance. <br> <br>We
define {{GERONIMO_SERVER}} in order to have the Geronimo start procedures startup an instance.
<br> <br>h2. Path Resolution <br> <br>{{GERONIMO_HOME}} is obtained
during startup relative to the directory Geronimo is installed in. By default, if the user
does not define {{GERONIMO_SERVER}} it is set to {{GERONIMO_HOME}}. If the user defines {{GERONIMO_SERVER}}
it is attempted to be resolved to an absolute path in the following ways: <br># First,
as an absolute path IFF {{GERONIMO_SERVER}} is absolute <br>** {{GERONIMO_SERVER}} <br>#
Second, as a relative path to {{GERONIMO_HOME}} IFF {{GERONIMO_SERVER}} is not absolute <br>**
{{GERONIMO_HOME}}/{{GERONIMO_SERVER}} <br> <br>h2. Technical Terms <br>_Skip
this sub-section if you do not care about the technical internals of Geronimo&#39;s use
of {{GERONIMO_HOME}} versus {{GERONIMO_SERVER}}_ <br> <br>Inside Geronimo there
is a concept of {{home}}, {{base}}, and {{server}}, with corresponding java properties {{org.apache.geronimo.home.dir}}
and {{org.apache.geronimo.server.dir}}. {{base}} and {{server}} are the same, but Geronimo
references {{base}} in general to reference the location for run-time configuration. The definition
of {{server}} is user provided, and redefines {{base}}. <br> <br>When Geronimo
runs, {{home}} and {{base}} properties are defined relative to the installation directory
of Geronimo. When a user starts up a Geronimo instance, the user defines the {{server}} property.
Defining the {{server}} property triggers Geronimo to change its {{base}} from {{home}} to
{{server}} thus starting up a Geronimo instance. <br> <br>Several internal libraries
used by Geronimo define two categories of properties as {{home}} and {{base}}, and Geronimo
defines these further when {{server}} is defined. Outside of running multiple Geronimo instances
{{base}} properties can be used to separate the binary installation from the user-modifiable
configuration for a single server installation when that is desirable in some disk layout
strategies. <br> <br> <br>h1. The layout of a Geronimo instance <br>
<br></td></tr>
            <tr><td class="diff-unchanged" >{excerpt}It is possible to run multiple
instances of Geronimo on the same machine.{excerpt} <br>Currently multiple instances
of Geronimo share the following directories in {{&lt;geronimo_home&gt;}}, the directory
where you installed Geronimo. These are read-only. <br></td></tr>
            <tr><td class="diff-changed-lines" >* <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">bin</span>
<span class="diff-added-words"style="background-color: #dfd;">&lt;GERONIMO_HOME&gt;/</span>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">**
bin <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">**</span> jsr88
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">**</span> lib <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">**</span> schema
<br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >The repository is shared, and
contains lots of basic and important libraries are required to bootstrap server. It is <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">possible</span>
<span class="diff-added-words"style="background-color: #dfd;">recommended</span>
to configure second repositories, one for each instance. See [Configuring multiple Repositories].
<br></td></tr>
            <tr><td class="diff-changed-lines" >* <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">repository</span>
<span class="diff-added-words"style="background-color: #dfd;">&lt;GERONIMO_HOME&gt;/</span>
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">**
repository  (This is the primary shared repository for bootstrapping Geronimo instances) <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">Each
instance gets its own copy of the following at {{&lt;geronimo_home&gt;/&lt;instance_name&gt;}}
. These are read-write and are necessary for each Geronimo instance. <br>* etc <br>*
var <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{info:title=suggestion}
<br>When running multiple instances, do not run a server from GERONIMO_HOME but only
from GERONIMO_SERVER roots. Also set the {{GERONIMO_HOME/repository}} to be read-only to help
prevent accidentally deploying to it when instead the intention is to deploy to the local
repository for each Geronimo instance at {{GERONIMO_SERVER/repository}}.  <br>{info}
<br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br>Each instance gets its own copy of the following at {{&lt;geronimo_home&gt;/&lt;instance_name&gt;}}
. {{etc}} is read-only and {{var}} is read-write. Both are necessary for each Geronimo instance.
<br>* &lt;GERONIMO_SERVER&gt;/ <br>** etc <br>** var <br>
<br></td></tr>
            <tr><td class="diff-unchanged" >These are also read-write but are
not part of the minimally necessary directories and files for running a Geronimo instance,
but may be desired. The {{deploy}} and {{repository}} directories will be automatically created
when you start Geronimo if they do not already exist. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">*
&lt;GERONIMO_SERVER&gt;/ <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">**</span> repository
 <span class="diff-changed-words">(<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">t</span><span
class="diff-added-chars"style="background-color: #dfd;">T</span>his</span>
is <span class="diff-added-words"style="background-color: #dfd;">the local repository</span>
under {{&lt;geronimo_home&gt;/&lt;instance_name&gt;}}, and is not the same
as the primary shared repository) <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">**</span> deploy
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">*</span>
<span class="diff-added-words"style="background-color: #dfd;">**</span> hotbundles
<br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >The bin, lib and schema directories
are read-only, and thus are shared between instances. The repository is also shared, which
means that an application deployed in one instance will show up in the list of deployed modules
for all instances. Thus creating the second repository for each instance <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">should
be desired.</span> <span class="diff-added-words"style="background-color: #dfd;">is
recommended to keep deployments local to the Geronimo instances.</span> See [Configuring
multiple Repositories] <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">Here
is an example layout of what it would look like to have installed one Geronimo instance named
&quot;foo-server&quot;. <br>{noformat:borderStyle=solid} <br>/opt/geronimo3
   - GERONIMO_HOME <br>|-- bin           - read-only <br>|-- foo-server    - GERONIMO_SERVER
<br>|   |-- etc           - read-only for the instance <br>|   |-- repository
   - read-write (The instance&#39;s local repository you do want to deploy to) <br>|
  `-- var           - read-write <br>|-- jsr88         - read-only <br>|-- lib
          - read-only <br>|-- repository    - read-write (The primary shared repository
you don&#39;t want to deploy to) <br>`-- schema        - read-only <br>{noformat}
<br> <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h1. Creating a new server instance
<br> <br>Start with a fresh image of Geronimo. Do not use an image that has been
used to run the default instance. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >To create an instance named <span
class="diff-changed-words">{{foo<span class="diff-added-chars"style="background-color:
#dfd;">-server</span>}}</span> do the following. All your instance data will
be put in <span class="diff-changed-words">{{&lt;geronimo_home&gt;/foo<span
class="diff-added-chars"style="background-color: #dfd;">-server</span>}}.</span>
All the directories named below are relative to {{&lt;geronimo_home&gt;}}. <br></td></tr>
            <tr><td class="diff-unchanged" >Follow the procedures as below: <br></td></tr>
            <tr><td class="diff-changed-lines" ># Create a directory <span
class="diff-changed-words">{{foo<span class="diff-added-chars"style="background-color:
#dfd;">-server</span>}}</span> under {{&lt;geronimo_home&gt;}}. <br></td></tr>
            <tr><td class="diff-unchanged" ># Copy {{var}} and {{etc}} directories
to {{foo}}. You can use the command [deploy:new-server-instance|gogo commands for Geronimo#gogocommandsforGeronimo-gogocommandnewserverinstance]
to help you with this step. <br></td></tr>
            <tr><td class="diff-changed-lines" ># Recommended: create <span
class="diff-changed-words">{{foo<span class="diff-added-chars"style="background-color:
#dfd;">-server</span>/repository}}</span> and set it up as a second repository
for the Geronimo instance. See [Configuring multiple Repositories] <br></td></tr>
            <tr><td class="diff-changed-lines" ># Edit <span class="diff-changed-words">{{foo<span
class="diff-added-chars"style="background-color: #dfd;">-server</span>/var/config/config-substitutions.properties}}</span>
and change the portOffset. Try using any integers such as 1, 2, 10, 20, 30.. for various instances.
<br></td></tr>
            <tr><td class="diff-unchanged" > <br> <br>h1. Running
an instance <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">#
Set the {{org.apache.geronimo.server.name}} system property to define a server name before
you start the server. This system property is null by default, defining the server instance
at {{&lt;geronimo_home&gt;}} as the default instance. Use the syntax {{\-Dorg.apache.geronimo.server.name=foo}}
to change the server name to an instance named {{foo}} located at {{&lt;geronimo_home&gt;/foo}}.
Add this to your {{GERONIMO_OPTS}} environment variable: <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">#
Set the {{GERONIMO_HOME}} environment variable to define the server instance directory before
you start the server. This variable will be set to {{GERONIMO_HOME}} as default if not defined.
Set {{GERONIMO_SERVER=foo-server}} to change the server name to an instance named {{foo-server}}
located at {{&lt;GERONIMO_HOME&gt;/foo-server}}, or {{GERONIMO_SERVER=/opt/geronimo/foo-server}}
to set the absolute path. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >* On a Windows system: {{set <span
class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">GERONIMO_OPTS
&quot;-Dorg.apache.geronimo.server.name=foo&quot;}}</span> <span class="diff-added-words"style="background-color:
#dfd;">GERONIMO_SERVER=&quot;foo-server&quot;}}</span> <br></td></tr>
            <tr><td class="diff-changed-lines" >* On a Unix-like system: {{export
<span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">GERONIMO_OPTS=&quot;-Dorg.apache.geronimo.server.name=foo&quot;}}</span>
<span class="diff-added-words"style="background-color: #dfd;">GERONIMO_SERVER=&quot;foo-server&quot;}}</span>
<br></td></tr>
            <tr><td class="diff-unchanged" > <br># Start the server using
startup <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >** Copy the directories {{var}} and
{{etc}} to each instance directory <br>** Create a {{repository}} directory within each
instance directory and set it up as a second repository for the corresponding Geronimo instance.
See [Configuring multiple Repositories] <br></td></tr>
            <tr><td class="diff-changed-lines" >** Modify the <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{{gservN/var/config/config-substitutions.properties}}</span>
<span class="diff-added-words"style="background-color: #dfd;">{{gserv(1|2)/var/config/config-substitutions.properties}}</span>
file for each Geronimo instance changing the {{PortOffset}}. We&#39;ll set the {{PortOffset}}
for {{gserv1}} to 100 and the {{PortOffset}} for {{gserv2}} to 200 for our example. <br></td></tr>
            <tr><td class="diff-unchanged" >** Create a start script in each Geronimo
instance directory to make it easier to start each instance <br>*** {{/opt/geronimo3/gserv1/start.sh}}
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>export GERONIMO_HOME=/opt/geronimo3
<br></td></tr>
            <tr><td class="diff-changed-lines" >export <span class="diff-changed-words">GERONIMO_SERVER=<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">${GERONIMO_HOME}/</span>gserv1</span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">export
GERONIMO_OPTS=-Dorg.apache.geronimo.server.dir=${GERONIMO_SERVER} <br></td></tr>
            <tr><td class="diff-unchanged" >cd ${GERONIMO_SERVER} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>export GERONIMO_HOME=/opt/geronimo3
<br></td></tr>
            <tr><td class="diff-changed-lines" >export <span class="diff-changed-words">GERONIMO_SERVER=<span
class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">${GERONIMO_HOME}/</span>gserv2</span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">export
GERONIMO_OPTS=-Dorg.apache.geronimo.server.dir=${GERONIMO_SERVER} <br></td></tr>
            <tr><td class="diff-unchanged" >cd ${GERONIMO_SERVER} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >|-- RELEASE_NOTES-3.0-SNAPSHOT.txt
<br>|-- bin <br></td></tr>
            <tr><td class="diff-changed-lines" >|-- <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">deploy</span>
<span class="diff-added-words"style="background-color: #dfd;">-etc-</span> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">|--
etc <br></td></tr>
            <tr><td class="diff-unchanged" >|-- gserv1 <br>|   |-- etc <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >|   |-- start.sh <br>|   `--
var <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">|--
hotbundles <br></td></tr>
            <tr><td class="diff-unchanged" >|-- jsr88 <br>|-- lib <br></td></tr>
            <tr><td class="diff-changed-lines" >|-- <span class="diff-changed-words"><span
class="diff-added-chars"style="background-color: #dfd;">+</span>repository<span
class="diff-added-chars"style="background-color: #dfd;">+</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" >|-- schema <br></td></tr>
            <tr><td class="diff-changed-lines" >`-- <span class="diff-changed-words"><span
class="diff-added-chars"style="background-color: #dfd;">-</span>var<span class="diff-added-chars"style="background-color:
#dfd;">-</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">_It
is suggested that in {{GERONIMO_HOME}} {{etc}} and {{var}} are removed and {{repository}}
is made read-only_  <br></td></tr>
            <tr><td class="diff-unchanged" >* Finally you can start up each instance
by executing their associated start script you just created in the previous step <br>
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC30/Running+Geronimo+as+a+service"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC30/Running+Geronimo+as+a+service">Running
Geronimo as a service</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/GMOxDOC30/Running+Geronimo"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC30/Running+Geronimo">Running Geronimo</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;</td></tr></table></div>


<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>Regarding both Geronimo javaee6
and minimal release bundles. Full support for multiple instances was completed in <a href="https://issues.apache.org/jira/browse/GERONIMO-6270"
class="external-link" rel="nofollow">GERONIMO-6270</a> and its sub-tasks. This support
is available in the latest snapshots after March 1, 2012, and will be in the 3.0-beta-2 standard
release. This documents how to run multiple instances after applying the changes from GERONIMO-6270.

<p>For prior releases, multiple installations can safely run side-by-side by completely
copying the server folder to another, and start the 2nd server installation after changing
its portOffset value.</p></td></tr></table></div>

<h1><a name="RunningmultipleGeronimoinstances-%7B%7BGERONIMOHOME%7D%7Dversus%7B%7BGERONIMOSERVER%7D%7D"></a><tt>GERONIMO_HOME</tt>
versus <tt>GERONIMO_SERVER</tt></h1>

<p>Simply put, <tt>GERONIMO_HOME</tt> is the path to the server binary installation
and <tt>GERONIMO_SERVER</tt> is the path to the server run-time configuration.
<tt>GERONIMO_HOME</tt> is the path to where Geronimo was installed which every
instance references, and every Geronimo instance defines its own <tt>GERONIMO_SERVER</tt>
as the path to the configuration for the instance.</p>

<p>We define <tt>GERONIMO_SERVER</tt> in order to have the Geronimo start
procedures startup an instance.</p>

<h2><a name="RunningmultipleGeronimoinstances-PathResolution"></a>Path Resolution</h2>

<p><tt>GERONIMO_HOME</tt> is obtained during startup relative to the directory
Geronimo is installed in. By default, if the user does not define <tt>GERONIMO_SERVER</tt>
it is set to <tt>GERONIMO_HOME</tt>. If the user defines <tt>GERONIMO_SERVER</tt>
it is attempted to be resolved to an absolute path in the following ways:</p>
<ol>
	<li>First, as an absolute path IFF <tt>GERONIMO_SERVER</tt> is absolute
	<ul>
		<li><tt>GERONIMO_SERVER</tt></li>
	</ul>
	</li>
	<li>Second, as a relative path to <tt>GERONIMO_HOME</tt> IFF <tt>GERONIMO_SERVER</tt>
is not absolute
	<ul>
		<li><tt>GERONIMO_HOME</tt>/<tt>GERONIMO_SERVER</tt></li>
	</ul>
	</li>
</ol>


<h2><a name="RunningmultipleGeronimoinstances-TechnicalTerms"></a>Technical
Terms</h2>
<p><em>Skip this sub-section if you do not care about the technical internals
of Geronimo's use of <tt>GERONIMO_HOME</tt> versus <tt>GERONIMO_SERVER</tt></em></p>

<p>Inside Geronimo there is a concept of <tt>home</tt>, <tt>base</tt>,
and <tt>server</tt>, with corresponding java properties <tt>org.apache.geronimo.home.dir</tt>
and <tt>org.apache.geronimo.server.dir</tt>. <tt>base</tt> and <tt>server</tt>
are the same, but Geronimo references <tt>base</tt> in general to reference the
location for run-time configuration. The definition of <tt>server</tt> is user
provided, and redefines <tt>base</tt>.</p>

<p>When Geronimo runs, <tt>home</tt> and <tt>base</tt> properties
are defined relative to the installation directory of Geronimo. When a user starts up a Geronimo
instance, the user defines the <tt>server</tt> property. Defining the <tt>server</tt>
property triggers Geronimo to change its <tt>base</tt> from <tt>home</tt>
to <tt>server</tt> thus starting up a Geronimo instance.</p>

<p>Several internal libraries used by Geronimo define two categories of properties as
<tt>home</tt> and <tt>base</tt>, and Geronimo defines these further
when <tt>server</tt> is defined. Outside of running multiple Geronimo instances
<tt>base</tt> properties can be used to separate the binary installation from
the user-modifiable configuration for a single server installation when that is desirable
in some disk layout strategies.</p>


<h1><a name="RunningmultipleGeronimoinstances-ThelayoutofaGeronimoinstance"></a>The
layout of a Geronimo instance</h1>

<p>It is possible to run multiple instances of Geronimo on the same machine.<br/>
Currently multiple instances of Geronimo share the following directories in <tt>&lt;geronimo_home&gt;</tt>,
the directory where you installed Geronimo. These are read-only.</p>
<ul>
	<li>&lt;GERONIMO_HOME&gt;/
	<ul>
		<li>bin</li>
		<li>jsr88</li>
		<li>lib</li>
		<li>schema</li>
	</ul>
	</li>
</ul>


<p>The repository is shared, and contains lots of basic and important libraries are
required to bootstrap server. It is recommended to configure second repositories, one for
each instance. See <a href="/confluence/display/GMOxDOC30/Configuring+multiple+repositories"
title="Configuring multiple repositories">Configuring multiple repositories</a>.</p>
<ul>
	<li>&lt;GERONIMO_HOME&gt;/
	<ul>
		<li>repository  (This is the primary shared repository for bootstrapping Geronimo
instances)</li>
	</ul>
	</li>
</ul>


<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>suggestion</b><br
/>When running multiple instances, do not run a server from GERONIMO_HOME but only from
GERONIMO_SERVER roots. Also set the <tt>GERONIMO_HOME/repository</tt> to be read-only
to help prevent accidentally deploying to it when instead the intention is to deploy to the
local repository for each Geronimo instance at <tt>GERONIMO_SERVER/repository</tt>.</td></tr></table></div>


<p>Each instance gets its own copy of the following at <tt>&lt;geronimo_home&gt;/&lt;instance_name&gt;</tt>
. <tt>etc</tt> is read-only and <tt>var</tt> is read-write. Both are
necessary for each Geronimo instance.</p>
<ul>
	<li>&lt;GERONIMO_SERVER&gt;/
	<ul>
		<li>etc</li>
		<li>var</li>
	</ul>
	</li>
</ul>


<p>These are also read-write but are not part of the minimally necessary directories
and files for running a Geronimo instance, but may be desired. The <tt>deploy</tt>
and <tt>repository</tt> directories will be automatically created when you start
Geronimo if they do not already exist.</p>
<ul>
	<li>&lt;GERONIMO_SERVER&gt;/
	<ul>
		<li>repository  (This is the local repository under <tt>&lt;geronimo_home&gt;/&lt;instance_name&gt;</tt>,
and is not the same as the primary shared repository)</li>
		<li>deploy</li>
		<li>hotbundles</li>
	</ul>
	</li>
</ul>


<p>The bin, lib and schema directories are read-only, and thus are shared between instances.
The repository is also shared, which means that an application deployed in one instance will
show up in the list of deployed modules for all instances. Thus creating the second repository
for each instance is recommended to keep deployments local to the Geronimo instances. See
<a href="/confluence/display/GMOxDOC30/Configuring+multiple+repositories" title="Configuring
multiple repositories">Configuring multiple repositories</a></p>

<p>Here is an example layout of what it would look like to have installed one Geronimo
instance named "foo-server".</p>
<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedContent panelContent">
<pre>/opt/geronimo3    - GERONIMO_HOME
|-- bin           - read-only
|-- foo-server    - GERONIMO_SERVER
|   |-- etc           - read-only for the instance
|   |-- repository    - read-write (The instance's local repository you do want to deploy
to)
|   `-- var           - read-write
|-- jsr88         - read-only
|-- lib           - read-only
|-- repository    - read-write (The primary shared repository you don't want to deploy to)
`-- schema        - read-only
</pre>
</div></div>


<h1><a name="RunningmultipleGeronimoinstances-Creatinganewserverinstance"></a>Creating
a new server instance</h1>

<p>Start with a fresh image of Geronimo. Do not use an image that has been used to run
the default instance.</p>

<p>To create an instance named <tt>foo-server</tt> do the following. All
your instance data will be put in <tt>&lt;geronimo_home&gt;/foo-server</tt>.
All the directories named below are relative to <tt>&lt;geronimo_home&gt;</tt>.<br/>
Follow the procedures as below:</p>
<ol>
	<li>Create a directory <tt>foo-server</tt> under <tt>&lt;geronimo_home&gt;</tt>.</li>
	<li>Copy <tt>var</tt> and <tt>etc</tt> directories to <tt>foo</tt>.
You can use the command <a href="/confluence/display/GMOxDOC30/gogo+commands+for+Geronimo#gogocommandsforGeronimo-gogocommandsforGeronimogogocommandnewserverins...">deploy:new-server-instance</a>
to help you with this step.</li>
	<li>Recommended: create <tt>foo-server/repository</tt> and set it up as
a second repository for the Geronimo instance. See <a href="/confluence/display/GMOxDOC30/Configuring+multiple+repositories"
title="Configuring multiple repositories">Configuring multiple repositories</a></li>
	<li>Edit <tt>foo-server/var/config/config-substitutions.properties</tt>
and change the portOffset. Try using any integers such as 1, 2, 10, 20, 30.. for various instances.</li>
</ol>



<h1><a name="RunningmultipleGeronimoinstances-Runninganinstance"></a>Running
an instance</h1>

<ol>
	<li>Set the <tt>GERONIMO_HOME</tt> environment variable to define the server
instance directory before you start the server. This variable will be set to <tt>GERONIMO_HOME</tt>
as default if not defined. Set <tt>GERONIMO_SERVER=foo-server</tt> to change the
server name to an instance named <tt>foo-server</tt> located at <tt>&lt;GERONIMO_HOME&gt;/foo-server</tt>,
or <tt>GERONIMO_SERVER=/opt/geronimo/foo-server</tt> to set the absolute path.</li>
</ol>


<ul>
	<li>On a Windows system: <tt>set GERONIMO_SERVER="foo-server"</tt></li>
	<li>On a Unix-like system: <tt>export GERONIMO_SERVER="foo-server"</tt></li>
</ul>


<ol>
	<li>Start the server using startup
<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedContent panelContent">
<pre>&lt;geronimo_home&gt;/bin/startup
</pre>
</div></div></li>
	<li>To shutdown this instance, use the port number of RMI Naming port (default 1099).
For the new instance <tt>foo</tt>, the port number should be 1099 plus portOffset
specified in <tt>foo/var/config/config-substitutions.properties</tt>.
<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedContent panelContent">
<pre>&lt;geronimo_home&gt;/bin/shutdown --port &lt;RMI_port_num&gt;
</pre>
</div></div></li>
	<li>To deploy applications to this instance use the port number of RMI Naming port</li>
</ol>
<ul class="alternate" type="square">
	<li>This deploys to the primary Geronimo repository
<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedContent panelContent">
<pre>&lt;geronimo_home&gt;/bin/deploy --port &lt;RMI_port_num&gt; deploy
&lt;applications&gt;
</pre>
</div></div></li>
	<li>This deploys to a secondary Geronimo repository exclusive to the Geronimo server
defined in <tt>org.apache.geronimo.server.name=foo</tt> . See <a href="/confluence/display/GMOxDOC30/Configuring+multiple+repositories"
title="Configuring multiple repositories">Configuring multiple repositories</a> for
more detailed instructions.
<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedContent panelContent">
<pre>&lt;geronimo_home&gt;/bin/deploy --port &lt;RMI_port_num&gt; deploy
--targets &lt;foo_repo_name&gt; &lt;applications&gt;
</pre>
</div></div></li>
</ul>



<p>The Administrative Console can also be used for all these operations. Connect to
an instance by using the right HTTP port (default 8080).</p>

<h2><a name="RunningmultipleGeronimoinstances-Exampleruntimeformultipleinstances"></a>Example
runtime for multiple instances</h2>

<ul>
	<li>First download the Geronimo bundle distribution</li>
	<li>Determine what you want <tt>GERONIMO_HOME</tt> to be. We will use <tt>/opt/geronimo3</tt>
for this example.</li>
	<li>Unpack the Geronimo bundle, and move the unpacked directory to <tt>/opt/geronimo3</tt></li>
	<li>We'll create two Geronimo instances named gserv1 and gserv2
	<ul>
		<li>Create the Geronimo instance directories as <tt>/opt/geronimo3/gserv1</tt>
and <tt>/opt/geronimo3/gserv2</tt></li>
		<li>Copy the directories <tt>var</tt> and <tt>etc</tt> to
each instance directory</li>
		<li>Create a <tt>repository</tt> directory within each instance directory
and set it up as a second repository for the corresponding Geronimo instance. See <a href="/confluence/display/GMOxDOC30/Configuring+multiple+repositories"
title="Configuring multiple repositories">Configuring multiple repositories</a></li>
		<li>Modify the <tt>gserv(1|2)/var/config/config-substitutions.properties</tt>
file for each Geronimo instance changing the <tt>PortOffset</tt>. We'll set the
<tt>PortOffset</tt> for <tt>gserv1</tt> to 100 and the <tt>PortOffset</tt>
for <tt>gserv2</tt> to 200 for our example.</li>
		<li>Create a start script in each Geronimo instance directory to make it easier to
start each instance
		<ul>
			<li><tt>/opt/geronimo3/gserv1/start.sh</tt>
<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedContent panelContent">
<pre>#!/bin/bash
# Geronimo start script
# instance: gserv1

# Uncomment this to explicitly set Geronimo's runtime Java
#JAVA_HOME=/usr/jdk1.6.0_25
#PATH=${JAVA_HOME}/bin:${PATH}

export GERONIMO_HOME=/opt/geronimo3
export GERONIMO_SERVER=gserv1
cd ${GERONIMO_SERVER}

# Normal startup
${GERONIMO_HOME}/bin/startup
# Interactive startup
#${GERONIMO_HOME}/bin/geronimo run
</pre>
</div></div></li>
			<li><tt>/opt/geronimo3/gserv2/start.sh</tt>
<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedContent panelContent">
<pre>#!/bin/bash
# Geronimo start script
# instance: gserv2

# Uncomment this to explicitly set Geronimo's runtime Java
#JAVA_HOME=/usr/jdk1.6.0_25
#PATH=${JAVA_HOME}/bin:${PATH}

export GERONIMO_HOME=/opt/geronimo3
export GERONIMO_SERVER=gserv2
cd ${GERONIMO_SERVER}

# Normal startuo
${GERONIMO_HOME}/bin/startup
# Interactive startup
#${GERONIMO_HOME}/bin/geronimo run
</pre>
</div></div></li>
		</ul>
		</li>
		<li>On linux, make the start script is executable with chmod: chmod 755 start.sh</li>
	</ul>
	</li>
	<li>Your Geronimo installation file structure should look something similar to this:
<div class="preformatted panel" style="border-style: solid;border-width: 1px;"><div
class="preformattedContent panelContent">
<pre>/opt/geronimo3
|-- LICENSE
|-- NOTICE
|-- README.txt
|-- RELEASE_NOTES-3.0-SNAPSHOT.txt
|-- bin
|-- -etc-
|-- gserv1
|   |-- etc
|   |-- repository
|   |-- start.sh
|   `-- var
|-- gserv2
|   |-- etc
|   |-- repository
|   |-- start.sh
|   `-- var
|-- jsr88
|-- lib
|-- +repository+
|-- schema
`-- -var-
</pre>
</div></div>
<p><em>It is suggested that in <tt>GERONIMO_HOME</tt> <tt>etc</tt>
and <tt>var</tt> are removed and <tt>repository</tt> is made read-only</em>
</p></li>
	<li>Finally you can start up each instance by executing their associated start script
you just created in the previous step</li>
</ul>



<h1><a name="RunningmultipleGeronimoinstances-Furtherreadings"></a>Further
readings</h1>

<p>To use multiple repositories see <a href="/confluence/display/GMOxDOC30/Configuring+multiple+repositories"
title="Configuring multiple repositories">Configuring multiple repositories</a>.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Running+multiple+Geronimo+instances">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=20645442&revisedVersion=21&originalVersion=20">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/GMOxDOC30/Running+multiple+Geronimo+instances?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message