Sun Cluster Data Service for Apache Tomcat Guide for Solaris OS

Installing and Configuring Apache Tomcat on Shared Storage in a Non-Global Zone

These instructions assume that you are installing the Apache Tomcat software as the tomcat user in a shared directory.

The tasks you must perform to install and configure Apache Tomcat in the zone are as follows:

ProcedureExample: Preparing the Cluster for Apache Tomcat

    Install and configure the cluster as instructed in Sun Cluster Software Installation Guide for Solaris OS.

    Install the following cluster software components on both nodes.

    • Sun Cluster core software

    • Sun Cluster data service for Apache Tomcat

ProcedureExample: Configuring the Zone

In this task you will install the Solaris Container on phys-schost-1 and phys-schost-2. Therefore perform this procedure on both hosts.

  1. On local cluster storage of , create a directory for the zone root path.

    This example presents a sparse root zone. You can use a whole root zone if that type better suits your configuration.

    phys-schost-1# mkdir /zones
  2. Create a temporary file, for example /tmp/x, and include the following entries:

    create -b
    set zonepath=/zones/clu1
    set autoboot=true
    set pool=pool_default
    add inherit-pkg-dir
    set dir=/lib
    add inherit-pkg-dir
    set dir=/platform
    add inherit-pkg-dir
    set dir=/sbin
    add inherit-pkg-dir
    set dir=/usr
    add net
    set address=zone-1 Choose a different addtress (zone-2) on the second node.
    set physical=hme0
    add attr
    set name=comment
    set type=string
    set value="Apache Tomcat cluster zone" Put your desired zone name between the quotes here.
  3. Configure the failover zone, using the file you created.

    phys-schost-1# zonecfg -z clu1 -f /tmp/x
  4. Install the zone.

    phys-schost-1# zoneadm -z clu1 install
  5. Log in to the zone.

    phys-schost-1# zlogin -C clu1
  6. Open a new window to the same node and boot the zone?

    phys-schost-1# zoneadm -z clu1 boot
  7. Close this terminal window and disconnect from the zone console.

    phys-schost-1# ~~.

ProcedureExample: Configuring Cluster Resources for Apache Tomcat

  1. Register the HAStoragePlus resource type.

    phys-schost-1# clresourcetype register SUNW.gds SUNW.HAStoragePlus
  2. Create the Apache Tomcat resource group.

    phys-schost-1# clresourcegroup create -n phys-host-1:clu1,phys-host-2:clu1 RG-TOM
  3. Create the HAStoragePlus resource in the RG-TOM resource group.

    phys-schost-1# clresource create -g RG-TOM -t SUNW.HAStoragePlus -p AffinityOn=TRUE \
    -p FilesystemMountPoints=/global/mnt3,/global/mnt4 RS-TOM-HAS
  4. Enable the resource group.

    phys-schost-1# clresourcegroup online -M RG-TOM

ProcedureExample: Installing the Apache Tomcat Software on Local Storage

These steps illustrate how to install the Apache Tomcat software in the shared storage. As long as only one node is mentioned it needs to be the node where your resource group is online.

  1. Log in to the zone on both nodes.

    phys-schost-1# zlogin clu1
    phys-schost-2# zlogin clu1
  2. Add the tomcatgroup and user.

    zone-1# groupadd -g 1000 tomcat
    zone-1# useradd -g 1000 -d /global/mnt3/tomcat -m -s /bin/ksh tomcat
    zone-2# groupadd -g 1000 tomcat
    zone-2# useradd -g 1000 -d /global/mnt3/tomcat -m -s /bin/ksh tomcat
  3. Install the Apache Tomcat binaries.

    zone-1# su - tomcat
    zone-1$ gzcat apache-tomcat-5.5.17.tar.gz|tar xvf -
    zone-1$ gzcat apache-tomcat-5.5.17-compat.tar.gz|tar xvf -
  4. Create your environment script /global/mnt3/tomcat/env.kshwith the following contents.

    cat env.ksh 
  5. Leave the zone.

ProcedureExample: Modifying the Apache Tomcat Configuration File

In this task you will create the configuration file to prepare the Apache Tomcat database. It is assumed, that you are still logged in to this zone, otherwise log into this zone.

  1. Switch to the tomcat user.

    zone# su - tomcat
  2. Copy the Apache Tomcat configuration file from the agent directory to its deployment location.

    zone# cp /opt/SUNWsctomcat/bin/pfile /global/mnt3
    phys-schost-1# chown tomcat:tomcat /global/mnt3/pfile
  3. Add this cluster's information to the parameter file /global/mnt3/pfile.

    The following listing shows the relevant file entries and the values to assign to each entry.

    TestCmd="get /index.jsp"
  4. Save and close the file.

  5. Leave the zone.

  6. Copy the Apache Tomcat configuration file from the agent directory to its deployment location.

    phys-schost-1# cp /opt/SUNWsctomcat/util/sctomcat_config /global/mnt3
  7. Add this cluster's information to the sctomcat_config configuration file.

    The following listing shows the relevant file entries and the values to assign to each entry.

  8. Save and close the file.

ProcedureExample: Enabling the Apache Tomcat Software to Run in the Cluster

This task will register theApache Tomcat resource, it is essential, that you perform it on one node only.

  1. Run the sctomcat_register script to register the resource.

    phys-schost-1# ksh /opt/SUNWsctomcat/util/sctomcat_register \
    -f /global/mnt3/sctomcat_config
  2. Enable the resource.

    phys-schost-1# clresource enable RS-TOM