Go to main content

Oracle® Solaris Cluster Data Service for Apache Tomcat Guide

Exit Print View

Updated: August 2018
 
 

Planning the HA for Apache Tomcat Installation and Configuration

This section contains the information you need to plan your Oracle Solaris Cluster HA for Apache Tomcat installation and configuration.


Note -  HA for Apache Tomcat is supported on a zone cluster, and the zone-cluster node is treated like a global-cluster node.

Apache Tomcat and Oracle Solaris Zones

HA for Apache Tomcat is supported in an Oracle Solaris Cluster zone cluster. A zone cluster is an Oracle Solaris non-global zone of brand cluster that is created by using the clzonecluster command. A zone cluster forms a complete and separate cluster across the global-cluster nodes.

About Horizontal Scalability

Oracle Solaris Cluster includes a concept of horizontal scalability for data services called scalable service. IP-based load-balancing algorithms are integrated in this concept. Because of this reason you can scale horizontally without using hardware load balancers. For a more detailed discussion of this scalable service, see Concepts for Oracle Solaris Cluster 4.4.

Before using the HA for Apache Tomcat in a scalable configuration, you should closely examine the infrastructure of the cluster and the clients.

If your clients access your application using proxies, determine whether the used proxy stays the same during a session context. This is true for an intranet.

If the proxy changes during a session context, this signifies that from the load-balancing point of view that the source IP address is changing. This will spoil every IP based load-balancing effort, whether it is hardware or software.

When the client accesses the server over the Internet, it is not guaranteed that the source IP address remains the same during a session context.

HA for Apache Tomcat can be configured two ways to achieve horizontal scalability:

  • Using HA for Apache Tomcat in a purely scalable configuration.

  • Using HA for Apache Tomcat in a multiple-masters configuration.

The difference between the two configuration is in the way of accessing the nodes:

  • A client accesses the scalable configuration by its shared address. In this case, Oracle Solaris Cluster does the load-balancing.

  • A client accesses a multiple-masters configuration using each node's physical address. Load-balancing must be done outside of the cluster.

For more information about scalable data services, see Concepts for Oracle Solaris Cluster 4.4.

Both configuration options are discussed in the sections HA for Apache Tomcat as a Scalable Configuration and HA for Apache Tomcat as a Multiple-Masters Configuration.

HA for Apache Tomcat as a Scalable Configuration

You can use HA for Apache Tomcat in a scalable configuration if it is guaranteed that the source IP address remains the same during a session context. This guarantee is achieved, for example, in an intranet.

If the source IP address might change during a session context and a scalable configuration is required, Apache Tomcat needs to be configured with session replication. This can be done by the application using a global file system or a database.


Caution

Caution  -  You will experience a performance penalty from the session-replication approach.


You will obtain better performance by using Apache Tomcat's inbound memory session replication for a scalable configuration with changing source IP addresses.

HA for Apache Tomcat as a Multiple-Masters Configuration

You can use HA for Apache Tomcat in a multiple-masters configuration in the other scenarios. External load-balancing is required. A typical configuration uses the scalable Apache web server as a load balancer and configures one physical host name of an Apache Tomcat instance behind each instance of the Apache web server. Another option is to use a hardware load balancer, which handles the session context.

The difference between scalable and multiple-masters configurations is in the way the clients access the cluster nodes. In a scalable configuration, they access the shared address. Otherwise, the clients access the global zone or hostnames.

Configuration Restrictions

The configuration requirements in this section apply only to Apache Tomcat.


Caution

Caution  -  If your data service configuration does not conform to these requirements, the data service configuration might not be supported.


Restriction to Deploying HA for Apache Tomcat in a Scalable Configuration

Deploy a scalable 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.

Restriction for the Load_balancing_policy Property

Setting the resource property Load_balancing_policy to LB_STICKY is strictly required, if HA for Apache Tomcat is deployed in a scalable configuration with reliable source IP addresses when no session replication is configured. Otherwise, the behavior of the application becomes unpredictable. In every other scalable configuration, the Sticky Load_balancing_policy setting helps to get more cache hits out of your caches.

Restriction for Scalable Services and Oracle Solaris Zones

HA for Apache Tomcat can be deployed in scalable configurations in Oracle Solaris Zones only if you use the zone cluster feature of Oracle Solaris Cluster.

Restriction for Apache Tomcat 6.0.28, 6.0.29, and 7.06

Starting with Apache Tomcat versions 6.0.28, 6.0.29, and 7.06, you must use the wget probe algorithm. This bypasses the normal probe, enabling the TestUrl parameter to work correctly. You can choose to use the wget probe algorithm for earlier Apache Tomcat versions or continue to use the original mconnect probe algorithm.

Configuration Requirements

These requirements apply to HA for Apache Tomcat only. You must meet these requirements before you proceed with your HA for Apache Tomcat installation and configuration.


Caution

Caution  -  Your data service configuration might not be supported if you do not adhere to these requirements.


Location of the Tomcat Home Directory for Scalable or Multiple-Masters Configurations

If you intend to install Apache Tomcat in a scalable resource group, create the Tomcat Home directory and its dynamic data on local storage. This is required because Apache Tomcat uses the directory structure to store its configuration, logs, deployed applications, and so on.

If your local storage is not large enough, you can use a cluster file system on the shared storage.


Caution

Caution  -  In this scenario, the deployment of Tomcat applications needs to occur on every node where Apache Tomcat is hosted.


Load Balancing for Multiple-Master Configurations

If you intend to install Apache Tomcat in a multiple-masters configuration, an external load balancer is required.

Location of the Tomcat Home Directory for Failover Configurations

If you intend to install Apache Tomcat in a failover resource group, create the Tomcat Home directory on the shared storage. The location for the Tomcat Home directory can reside on a cluster file system or it can reside on a highly available local file system which uses an HAStoragePlus resource. It is best practice to store it on a highly available local file system.

This requirement is necessary because Apache Tomcat uses the directory structure to store its configuration, logs, deployed applications, and so on. It is not recommended to store the binaries local and the dynamic parts of the data on the shared storage.


Tip  -  Mount a cluster file system with the /global prefix and mount a highly available local file system with the /local prefix.

Location of the wget Command for Apache Tomcat 6.0.28, 6.0.29, and 7.06

To support the wget probe algorithm for Apache Tomcat 6.0.28, 6.0.29, and 7.06, the wget command must be available from every node of the cluster.

Apache Tomcat Component Dependencies

You can configure the HA for Apache Tomcat data service 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 described in Table 2, Dependencies Between HA for Apache Tomcat Components in Failover Configurations, Table 3, Dependencies Between HA for Apache Tomcat Components in Scalable Configurations, Table 4, Dependencies Between HA for Apache Tomcat Components in Multiple-Masters Configurations, or Table 5, Dependency Types for HA for Apache Tomcat Resources.

Table 2  Dependencies Between HA for Apache Tomcat Components in Failover Configurations
Component
Dependency
Apache Tomcat resource
SUNW.HAStoragePlus – This dependency is required only if the configuration uses a failover file system .
SUNW.LogicalHostName

Because of the special requirements of a scalable configuration, you need no dependencies to storage or addresses, as long as every Apache Tomcat and its parameter file pfile is stored on the root file system. Otherwise, follow Table 3, Dependencies Between HA for Apache Tomcat Components in Scalable Configurations.

Table 3  Dependencies Between HA for Apache Tomcat Components in Scalable Configurations
Component
Description
Storage Resource
This resource is a SUNW.HAStoragePlus resource type.
(Mandatory) Apache Tomcat
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.
(Mandatory) Shared address
The shared address resource resides in a separate resource group on which the scalable resource group depends.

A multiple-masters configuration is running on more than one nodes like a scalable configuration, but without a shared address. Because of the special requirements of a multiple-masters configuration, you need no dependencies to storage or addresses, as long as every Apache Tomcat and its parameter file pfile is stored on the root file system. Otherwise, follow Table 4, Dependencies Between HA for Apache Tomcat Components in Multiple-Masters Configurations.

Table 4  Dependencies Between HA for Apache Tomcat Components in Multiple-Masters Configurations
Component
Dependency
Apache Tomcat resource
SUNW.HAStoragePlus. This dependency is required only, if the configuration uses a failover file system.

If more elaborate dependencies are required, see the r_properties(7) and rg_properties(7) man pages for further dependencies and affinities settings.


Note -  For more detailed information about Apache Tomcat, refer to the http://jakarta.apache.org web page.

A SUNW.HAStoragePlus resource requires a Resource_offline_restart dependency type, while all other resources require a strong dependency type called Resource_dependencies. You must define the Resource_offline_restart dependency for the SUNW.HAStoragePlus resource if the resource type version is at least version 9. See Table 5, Dependency Types for HA for Apache Tomcat Resources for the dependency type needed for each resource. The following resources are examples and you should evaluate the dependency to other resources on a case-by-case basis.

Table 5  Dependency Types for HA for Apache Tomcat Resources
Resource Name
Dependency Type
SUNW.HAStoragePlus
Resource_offline_restart
SUNW.HAStorage
Resource_dependencies
SUNW.LogicalHostName
Resource_dependencies

HA for Apache Tomcat Configuration and Registration Files

Apache Tomcat component has configuration and registration files in the directory /opt/SUNWsctomcat/util. These files let you register the Apache Tomcat component with Oracle Solaris Cluster.

Within these files, the appropriate dependencies have been applied.

# cd /opt/SUNWsctomcat
# ls -l util
total 4
-rwxr-xr-x   1 root     bin   1619 Apr 29 11:57 sctomcat_config
-r-xr-xr-x   1 root     bin   7058 Apr 29 11:58 sctomcat_register
# more util/*g
::::::::::::::
util/sctomcat_config
::::::::::::::
#
# Copyright 2006, 2012, Oracle and/or its affiliates.  All rights reserved.
#

#ident   "@(#)sctomcat_config.ksh 1.2     01/03/12"

# 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 for a scalable resource or false for a failover resource
#   NETWORK - false or true, false for multiple master configurations without
#             shared address, in this case SCALABLE will be ignored
#
#     PFILE - absolute path 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)
#
# The following variables need to be set only if the agent runs in a
# local zone
#      ZONE - the zone name where the Apache Tomcat should run in
#             Optional
#    ZONEBT - The resource name which controls the zone.
#             Optional
#   PROJECT - A project in the zone, that will be used for this service
#             specify it if you have an su - in the start stop or probe,
#             or to define the smf credentials. If the variable is not set,
#             it will be translated as :default for the smf manifest
#             Optional

RS=
RG=
PORT=
LH=
NETWORK=false
SCALABLE=false
PFILE=
HAS_RS=

# local zone specific options

ZONE=
ZONE_BT=
PROJECT=