Web clustering

        Load-balancing at the web level with mod_jk

        Configure HTTP session replication with Tomcat

Ejb clustering

        CMI Configuration (JNDI & EJB load balancing)

        EJB high availability

Building the JOnAS's cluster configuration

Web clustering

Load-balancing at the web level with mod_jk

Configure Mod_jk

This depends on the distribution being used. Create a file tomcat_jk.conf and workers.properties in "$APACHE_HOME/conf/jk/".

Configure Apache 2

Configure Tomcat

To configure Tomcat, perform the following configuration steps for each Tomcat server with the right AJP port number.
  1. Configure Tomcat for the connector AJP13. In the file conf/server.xml of the JOnAS installation directory, add the AJP connector related to the worker (if not already there):

    <!-- Define an AJP 1.3 Connector on port 9010 -->
    <Connector
        port="9010" minProcessors="5" maxProcessors="75"
        acceptCount="10" debug="20" protocol="AJP/1.3"/>
    Explanations:
      port: The TCP port number on which this Connector will create a server socket and await incoming connections.
      minProcessor: The minimum number of processors to start at intialization time. If not specified, this attribute is set to 5.
      maxProcessor: The maximum number of processors allowed.
      acceptCount: The maximum queue length for incoming connection requests when all possible requests processing threads are in use. Any requests received when the queue is full will be refused.
      debug: The debugging detail level of log messages generated by this component, with higher numbers creating more detailed output.
      protocol: This attribute must be AJP/1.3 to use the AJP handler.

    Note: Refer to the AJP Connector documentation.

  2. Define the jvmRoute.
    In the file conf/server.xml of the JOnAS installation directory, add a unique route to the Catalina engine with the right worker name.
    Replace the line:
    <Engine name="Standalone" defaultHost="localhost" debug="0">
    with:
    <Engine jvmRoute="worker1" name="Standalone" defaultHost="localhost" debug="0">

    Explanations:
      name: Logical name of this Engine, used in log and error messages
      jvmRoute: Uniquely identifies the Tomcat server to the Apache server
    Name has been specified in workers.properties
      defaultHost: Identifies the Host that will process requests directed to host names on this server
      debug: The level of debugging detail logged by this Engine

    Note: The jvmRoute name should be the same as the name of the associated worker defined in workers.properties. This will ensure the Session affinity.
               Refer to the Engine Container documentation.

Configure HTTP session replication with Tomcat

Running the Web Application

The web application is now ready to run in the cluster:
  1. Start the JOnAS servers: jonas start.
  2. Restart Apache: /usr/local/apache2/bin/apachectl restart.
  3. Use a browser to access the welcome page, usually index.html.

Ejb clustering

Note: More detailed information is available in the CMI guide .

CMI Configuration (JNDI & EJB load balancing)

In the case of EJB level clustering (CMI), the client may be either a fat Java client (e.g., a Swing application), or a Web application (i.e., Servlets/JSPs running within JOnAS). In the second case, the JOnAS server running the Web client should be configured in the same way as the other nodes of the cluster.

Note 1: The multicast address and port defined in the $JONAS_BASE/conf/jgroups-cmi.xml and the group name defined in the $JONAS_BASE/conf/carol.properties file must be the same for all JOnAS nodes in the cluster.

Note 2: If Tomcat Replication associated to cmi is used, the multicast addresses of the two configurations must be different. Same requirement for the EJB high availability configuration.

Note 3: If the cluster is defined across several machines, the CMI url has to be set with the real ip address or ip alias and not the loopback address.Otherwise, the EJBs won't be reachable from the remote machines.

EJB high availability

This section describes how to enable the EJB replication framework (SFSB).