This procedure assumes that you installed the data service packages.
If you did not install the Sun Cluster HA for Apache Tomcat packages, go to Installing the Sun Cluster HA for Apache Tomcat Packages.
It is assumed that the file system of Apache Tomcat will be mounted as a failover file system.
Become superuser on one of the nodes in the cluster that will host Apache Tomcat.
Register the SUNW.gds resource type.
# scrgadm -a -t SUNW.gds |
Register the SUNW.HAStoragePlus resource type.
# scrgadm -a -t SUNW.HAStoragePlus |
Create a failover resource group.
# scrgadm -a -g Apache-Tomcat-failover-resource-group |
Create a resource for the Apache Tomcat Disk Storage.
# scrgadm -a -j Apache-Tomcat-has-resource \ > -g Apache-Tomcat-failover-resource-group \ > -t SUNW.HAStoragePlus \ > -x FilesystemMountPoints=Apache Tomcat- instance-mount-points |
Create a resource for the Apache Tomcat Logical Host name.
# scrgadm -a -L -j Apache-Tomcat-lh-resource \ > -g Apache-Tomcat-failover-resource-group \ > -l Apache-Tomcat-logical-hostname |
Enable the failover resource group, which now includes the Apache Tomcat Disk Storage and Logical Hostname resources.
# scswitch -Z -g Apache-Tomcat-failover-resource-group |
Prepare the parameter file, which is required by the Sun Cluster HA for Apache Tomcat.
# cd /opt/SUNWsctomcat/bin # cp pfile desired place |
Edit the parameter file pfile and follow the comments within that file. For example:
#!/usr/bin/ksh # Set the Apache Tomcat specific environment variables which the start, # stop and check functions will use # # EnvScript Script to set runtime environment for tomcat # User Apache Tomcat user name # Basepath Absolute pathname to Tomcat Home directory i.e. 4.x CATALINA_HOME # or TOMCAT_HOME for 3.x # Host Hostname to test Apache Tomcat # Port Port where Apache Tomcat is configured # TestCmd Apache Tomcat test command # Startwait Sleeping $Startwait seconds after completion of the # start command EnvScript= User= Basepath= Host= Port=8080 TestCmd="get /index.jsp" ReturnString="CATALINA" Startwait=20 |
The following is an example for Apache Tomcat 4.1.24.
EnvScript=/global/mnt1/tomtest/env.ksh User=tomtest Basepath=/global/mnt1/tomtest/jakarta-tomcat-4.1.24 Host=tomcat-lh Port=8080 TestCmd="get /index.jsp" ReturnString="CATALINA" Startwait=20 |
This example is from an Apache Tomcat 4.1.24 configured as standalone web server with the default start page index.jsp. The start page contains the string CATALINA.
The parameter files need to be available on every node that can host the Apache Tomcat data service. For a failover configuration store them on the shared storage. The parameter files cannot differ for an instance of Apache Tomcat on the various nodes.
Repeat Step 8 for every Apache Tomcat instance you need.
Create and register each required Apache Tomcat component.
# cd /opt/SUNWsctomcat/util # cp sctomcat_config desired place # cp sctomcat_register desired place |
Edit the sctomcat_config file and follow the comments within that file. For example:
# These parameters can be customized in (key=value) form # # 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= |
The following is an example for Apache Tomcat.
RS=tomcat-res RG=tomcat-rg PORT=8080 LH=tomcat-lh SCALABLE=false PFILE=/global/mnt1/pfile HAS_RS=tomcat-hastplus-res |
After editing sctomcat_config register the resource.
# ./sctomcat_register |
Repeat Step 7,8, and 9 for each Apache Tomcat instance you need.
Enable each Apache Tomcat resource.
Repeat this step for each Apache Tomcat resource created in the step 10.
# scstat |
# scswitch -e -j Apache-Tomcat-resource |