This section contains the information you need to plan your Sun Cluster HA for Apache Tomcat installation and configuration.
Sun Cluster comes up with a concept of horizontal scalability for data services called scalable service, ip based load balancing algorithms are integrated in this concept. On behalf of this reason you can scale horizontally without using hardware loadbalancers. For a deeper discussion of this scalable service see the Sun Cluster Concepts Guide.
Before using the Sun Cluster HA for Apache Tomcat in a scalable configuration it is necessary to have a closer look on the infrastructure of the cluster and the clients.
If your clients access your application via proxies, you need to determine whether the used proxy stays the same during a session context. This can be guaranteed for an intranet, but it needs some investigation.
If the proxy changes during a session context it means, from the load balancing point of view, that the source ip address is changing. This will spoil every ip based load balancing, wether it is hardware or software.
Especially when your application is facing the internet, it is not guaranteed, that the source ip address remains the same during a session context.
Several options to solve this issue and get horizontal scalability from your Apache Tomcat are available.
Sun Cluster HA for Apache Tomcat can be configured two ways to get horizontal scalability.
Using Sun Cluster HA for Apache Tomcat in a purely scalable configuration.
Using Sun Cluster HA for Apache Tomcat in a multiple masters configuration.
Multiple masters configurations and scalable configurations are both configured as a scalable data service. The difference between the two configuration lies in the way of accessing the nodes.
A client accesses the scalable configuration via it's shared address. In this case Sun Cluster does the load balancing.
A client accesses a multiple masters configuration every via every nodes physical address. Load balancing needs to be done somewhere else.
For more information about scalable data services, see the Sun Cluster Concepts Guide.
Sun Cluster HA for Apache Tomcat as a scalable configuration
You can use Sun Cluster HA for Apache Tomcat in a scalable configuration if it is guaranteed, that the source ip address remains the same during a session context in example. in an intranet.
If the source ip address might change during a session context and scalable is the way to go, Apache Tomcat needs to be configured with session replication. This can be done by the application using a global file system or a database.
You will get a performance penalty from this approach.
It is much more performant to use Tomcats inbound memory session replication for this purpose.
You can achieve this for Apache Tomcat 4.x by following the instructions at http://www.theserverside.com/resources/article.jsp?l=Tomcat.
Inbound memory session replication as a built in feature, is on the feature list Apache Tomcat 5.x.
For Apache Tomcat 3.x the inbound memory session replication is not configurable.
Sun Cluster HA for Apache Tomcat as a multiple master configuration
You can use Sun Cluster HA for Apache Tomcat in a multiple master configuration in the other scenarios. Be aware, that external load balancing is required. A typical configuration is using the scalable Apache webserver as a load balancer and configure one physical hostname of an Apache Tomcat instance behind each instance of the Apache Web server. An other option is to use a hardware loadbalancer which has to handle the session context.
The difference between scalable and multiple masters configuration is only in the way, the clients access the cluster nodes. In a scalable configuration they access the shared address, otherwise the clients accesses the physical hostnames. So from the Sun Cluster point of view there is no difference between the two configurations.
Consider the restrictions in this section to plan the installation and configuration of Sun Cluster HA for Apache Tomcat. This section provides a list of software and hardware configuration restrictions that apply to Sun Cluster HA for Apache Tomcat only.
For restrictions that apply to all data services, see the Sun Cluster Release Notes.
Deploy a scalable Sun Cluster HA for Apache Tomcat configuration only if either session replication, or reliable source ip addresses are achieved. Otherwise the behavior of the application becomes unpredictable.
Setting the resource parameter Load_balancing_policy to LB_STICKY is strictly required, if Sun Cluster HA for Apache Tomcat is deployed in a scalable configuration with reliable source ip addresses. Especially when no session replication is configured. Otherwise the behavior of the application becomes unpredictable. In every other scalable configuration it helps to get the best out of your caches.
Your data service configuration might not be supported if you do not observe these restrictions.
Use the requirements in this section to plan the installation and configuration of Apache Tomcat. These requirements apply to Sun Cluster HA for Apache Tomcat only. You must meet these requirements before you proceed with your Sun Cluster HA for Apache Tomcat installation and configuration.
Your data service configuration might not be supported if you do not adhere to these requirements.
Configure the Tomcat Home directory on local storage for a scalable or multiple masters configuration– if you intend to install Apache Tomcat in a scalable resource group, you should create the Tomcat Home directory and it's dynamic data onto your local Storage.
This required because Apache Tomcat uses the directory structure to store it's configuration, logs, deployed applications and so on.
However, if your local storage is not big enough, it is acceptable to use a Global File System on the shared storage.
In this scenario, the deployment of Tomcat applications needs to occur on every node where Apache Tomcat is hosted.
Deploy Sun Cluster HA for Apache Tomcat multiple master configuration — If you intend to install Apache Tomcat in a multiple master configuration, a load balancer as discussed above is required.
Configure the Apache Tomcat Home directory on shared storage for a failover configuration – If you intend to install Apache Tomcat in a failover resource group, you should create the Tomcat Home directory on the shared storage. The location for the Tomcat Home directory can reside on a Global File System (GFS) or it can reside on a Failover File System (FFS) with an HAStoragePlus resource. It is best practice to store it on a FFS.
This is required because Apache Tomcat uses the directory structure to store its configuration, logs, deployed applications and so on. It is possible to store the binaries local and the dynamic parts of the data on the shared storage, but it is not recommended.
It is considered best practice when mounting Global File Systems to mount them with the /global prefix and to mount Failover File Systems with the /local prefix. However, be aware that this is simply viewed as best practice.
Apache Tomcat component and his dependencies —The Sun Cluster HA for Apache Tomcat data service can be configured to protect one or more Apache Tomcat instances. Each instance needs to be covered by one Apache Tomcat resource. The dependencies between the Apache Tomcat resource and other needed resources, are briefly described below.
Table 1–5 Apache Tomcat component and his dependencies for a failover configuration (via -> symbol)
Component |
Description |
---|---|
Storage Resource |
This resource can be a SUNW.HAStoragePlus or an SUNW.HAStorage resource type. |
Apache Tomcat(Mandatory) |
-> SUNW.HAStoragePlus / SUNW.HAStorage resource The Storage resource manages the Apache Tomcat File System Mount points and ensures that Apache Tomcat is not started until they are mounted. |
Logical Host(Mandatory) |
The Apache Tomcat has an implicit dependency on the logical hosts of the resource group, because it is based on the generic data service. On behalf of this reason a logical Host needs to exist, but no explicit dependency is necessary. |
Due to the special requirements of a scalable configuration, you need no dependencies to storage or addresses, as long as every Apache Tomcat and it's parameter file pfile is stored on the root file system. Otherwise follow the table below.
Table 1–6 Apache Tomcat component and his dependencies for a scalable or multiple masters configuration (via -> symbol)
Component |
Description |
---|---|
Storage Resource |
This resource can be a SUNW.HAStorage or a SUNW.HAStoragePlus resource type. |
Apache Tomcat(Mandatory) |
-> Storage resource The Storage resource manages the Apache Tomcat File System Mount points and ensures that Apache Tomcat is not started until they are mounted. |
shared address(Mandatory) |
The shared address resource resides in a separate resource group on which the scalable resource group depends. |
For more detailed information about Apache Tomcat, refer to jakarta.apache.org webpage.
The Apache Tomcat, component has a configuration and a registration file under, /opt/SUNWsctomcat/util. These files allow you to register the Apache Tomcat component with Sun Cluster.
Within these files, the appropriate dependencies have already been applied.
# cd /opt/SUNWsctomcat # # ls -l util total 4 -rwx--x--- 1 root other 709 Apr 29 11:57 sctomcat_config -rwx--x--- 1 root other 561 Apr 29 11:58 sctomcat_register # more util/* :::::::::::::: util/sctomcat_config :::::::::::::: # # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This file will be sourced in by sctomcat_register and the parameters # listed below will be used. # # These parameters can be customized in (key=value) form # # RS - name of the resource for the application # RG - name of the resource group containing RS # PORT - name of the port number # LH - name of the LogicalHostname SC resource # SCALABLE - true or false for a scalable or failover resource # PFILE - absolute pathname to the parameter file for the Tomcat resource # HAS_RS - name of the HAStoragePlus SC resource # (it can be a , separated list for the dependencies) # RS= RG= PORT=8080 LH= SCALABLE=false PFILE= HAS_RS= :::::::::::::: util/sctomcat_register :::::::::::::: # # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # . `dirname $0`/sctomcat_config scrgadm -a -j $RS -g $RG -t SUNW.gds \ -x Start_command="/opt/SUNWsctomcat/bin/start_sctomcat \ -R $RS -G $RG -N $PFILE " \ -x Stop_command="/opt/SUNWsctomcat/bin/stop_sctomcat \ -R $RS -G $RG -N $PFILE " \ -x Probe_command="/opt/SUNWsctomcat/bin/probe_sctomcat \ -R $RS -G $RG -N $PFILE " \ -y Port_list=$PORT/tcp -y Network_resources_used=$LH \ -x Stop_signal=9 \ -y Scalable=$SCALABLE \ -y Resource_dependencies=$HAS_RS |