You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

For the Geronimo javaee6 release bundles, you can only run multiple instance by completely copying the server folder to another, and start a 2nd instance after changing its portOffset value.

The feature described on this page was not fully supported yet, using GERONIMO-5987 to track the status.

It is possible to run multiple instances of Geronimo on the same machine. Currently multiple instances of Geronimo share the following directories in <geronimo_home>, the directory where you installed Geronimo. These are read-only.

  • bin
  • jsr88
  • lib
  • schema

Each instance gets its own copy of the following at <geronimo_home>/<instance_name> . These are read-write and are necessary for each Geronimo instance.

  • etc
  • repository
  • var

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 directory will be automatically created when you start Geronimo if it does not already exist.

  • deploy
  • hotbundles

The bin, lib and schema directories are read-only, and thus are shared between instances. The repository is not shared, which means that an application deployed in one instance will only show up in the list of deployed modules of the deployed instance.

Creating a new server instance

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

To create an instance named foo do the following. All your instance data will be put in <geronimo_home>/foo. All the directories named below are relative to <geronimo_home>.
Follow the procedures as below:

  1. Create a directory foo under <geronimo_home>.
  2. Copy var, repository and etc directories to foo.You can use the command deploy:new-server-instance to help you with this step.
  3. Edit foo/var/config/config-substitutions.properties and change the portOffset. Try using any integers such as 1, 2, 10, 20, 30.. for various instances.

Running an instance

  1. 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 <geronimo_home> 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 <geronimo_home>/foo. Add this to your GERONIMO_OPTS environment variable:
  • On a Windows system: set GERONIMO_OPTS=-Dorg.apache.geronimo.server.name=foo
  • On a Unix-like system: export GERONIMO_OPTS=-Dorg.apache.geronimo.server.name=foo
  1. Start the server using startup
    <geronimo_home>/bin/startup
    
  2. To shutdown this instance, use the port number of RMI Naming port (default 1099). For the new instance foo, the port number should be 1099 plus portOffset specified in foo/var/config/config-substitutions.properties.
    <geronimo_home>/bin/shutdown --port <port_num>
    
  3. To deploy applications to this instance use the port number of RMI Naming port
    <geronimo_home>/bin/deploy --port <port_num> deploy <applications>
    

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

Example runtime for multiple instances

  • First download the Geronimo bundle distribution
  • Determine what you want GERONIMO_HOME to be. We will use "/opt/geronimo3" for this example.
  • Unpack the Geronimo bundle, and move the unpacked directory to "/opt/geronimo3"
  • We'll create two Geronimo instances named gserv1 and gserv2
    • Create the Geronimo instance directories as "/opt/geronimo3/gserv1" and "/opt/geronimo3/gserv2"
    • Copy the directories "var", "etc", and "repository" to each instance directory
    • Modify the "var/config-substitutions" file for each Geronimo instance changing the PortOffset. We'll set the PortOffset for gserv1 to 100 and the PortOffset for gserv2 to 200 for our example.
    • Create a start script in each Geronimo instance directory to make it easier to start each instance
      • /opt/geronimo3/gserv1/start.sh
        #!/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}
        
        GHOME=/opt/geronimo3
        GVIRT=gserv1
        
        export GERONIMO_OPTS=-Dorg.apache.geronimo.server.name=${GVIRT}
        # Normal startuo
        ${GHOME}/bin/startup
        # Interactive startup
        #${GHOME}/bin/geronimo run
        
      • /opt/geronimo3/gserv2/start.sh
        #!/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}
        
        GHOME=/opt/geronimo3
        GVIRT=gserv2
        
        export GERONIMO_OPTS=-Dorg.apache.geronimo.server.name=${GVIRT}
        # Normal startuo
        ${GHOME}/bin/startup
        # Interactive startup
        #${GHOME}/bin/geronimo run
        
    • On linux, make the start script is executable with chmod: chmod 755 start.sh
  • Finally you can start up each instance by executing their associated start script you just created in the previous step
  • Your Geronimo installation file structure should look something similar to this:
    /opt/geronimo3
    |-- LICENSE
    |-- NOTICE
    |-- README.txt
    |-- RELEASE_NOTES-3.0-SNAPSHOT.txt
    |-- bin
    |-- deploy
    |-- etc
    |-- gserv1
    |   |-- etc
    |   |-- repository
    |   |-- start.sh
    |   `-- var
    |-- gserv2
    |   |-- etc
    |   |-- repository
    |   |-- start.sh
    |   `-- var
    |-- hotbundles
    |-- jsr88
    |-- lib
    |-- repository
    |-- schema
    `-- var
    

Further readings

To use multiple repositories see Configuring multiple Repositories.

  • No labels