Sun Cluster Data Service for Apache Guide for Solaris OS

Registering and Configuring Sun Cluster HA for Apache

This procedure describes how to use the scrgadm(1M) command to register and configure Sun Cluster HA for Apache.

You can configure Apache as a failover service or as a scalable service, as follows.

The scalable resource group depends on the failover resource group. Additional steps are required to configure Apache as a scalable service. The leading text “For scalable services only” in the following procedure identifies these steps. If you are not configuring Apache as a scalable service, skip the steps marked “For scalable services only.”

How to Register and Configure Sun Cluster HA for Apache


Note –

Run this procedure on any cluster member.


  1. Become superuser on a cluster member.

  2. Register the resource type for the data service.


    # scrgadm -a -t SUNW.apache
    
    -a

    Adds the data service resource type.

    -t SUNW.apache

    Specifies the predefined resource type name for your data service.

  3. Create a failover resource group to hold the network and application resources.

    This resource group is required for both failover and scalable services. For failover services, the resource group contains both network and failover application resources. For scalable services, the resource group contains network resources only. A dependency is created between this group and the resource group that contains the application resources.

    Optionally, you can select the set of nodes on which the data service can run with the -h option.


    # scrgadm -a -g resource-group [-h nodelist]
    -a

    Adds a new configuration.

    -g resource-group

    Specifies the name of the failover resource group to add. This name can be your choice but must be unique for the resource groups within the cluster.

    [-h nodelist]

    An optional comma-separated list of physical node names or IDs that identify potential masters. The order specified here determines the order in which the nodes are considered as primary during failover.


    Note –

    Use -h to specify the order of the node list. If all of the nodes that are in the cluster are potential masters, you do not need to use the -h option.


  4. Verify that all of the network addresses that you use have been added to your name service database.

    You should have performed this verification during your initial Sun Cluster installation. See the planning chapter in the Sun Cluster Software Installation Guide for Solaris OS for details.


    Note –

    To avoid failures because of name service lookup, verify that all of the network addresses are present in the /etc/inet/hosts file on all of the cluster nodes. Configure name service mapping in the /etc/nsswitch.conf file on the servers to first check the local files prior to accessing NIS, NIS+, or DNS.


  5. Add a network resource (logical hostname or shared address) to the failover resource group that you created in Step 3.


    # scrgadm -a {-S | -L} -g resource-group \
    -l hostname, … [-j resource] \
    [-X auxnodelist] [-n netiflist]
    -S | -L

    The -S option specifies shared address resources. The -L option specifies logical hostname resources.

    -l hostname, …

    Specifies a comma-separated list of network resources to add. You can use the -j option to specify a name for the resources. If you do not do so, the network resources have the name of the first entry on the list.

    -g resource-group

    Specifies the name of the failover resource group that you created in Step 3.

    -j resource

    Specifies a resource name. If you do not supply your choice for a resource name, the name of the network resource defaults to the first name that is specified after the -l option.

    -X auxnodelist

    Specifies a comma-separated list of physical node names or node IDs that identify cluster nodes that can host the shared address but never serve as primary in the case of failover. These nodes are mutually exclusive with the nodes identified in nodelist for the resource group, if specified.

    -n netiflist

    Specifies an optional, comma-separated list that identifies the IP Networking Multipathing groups that are on each node. Each element in netiflist must be in the form of netif@node. netif can be given as an IP Networking Multipathing group name, such as sc_ipmp0. The node can be identified by the node name or node ID, such as sc_ipmp0@1 or sc_ipmp@phys-schost-1.


    Note –

    Sun Cluster does not currently support using the adapter name for netif.


  6. For scalable services only – Create a scalable resource group to run on all of the desired cluster nodes.

    If you run Sun Cluster HA for Apache as a failover data service, proceed to Step 8.

    Create a resource group to hold a data service application resource. You must specify the maximum and desired number of primary nodes.


    Note –

    If only a subset of nodes can be primaries for this resource group, you must use the -h option to specify the names of these potential primaries when you create the resource group.


    You must also specify any dependency between this resource group and the failover resource group that you created in Step 3. This dependency ensures that when failover occurs, if the two resource groups are being brought online on the same node, the Resource Group Manager (RGM) starts up the network resource before any data services that depend on the network resource.


    # scrgadm -a -g resource-group \
    -y Maximum_primaries=m -y Desired_primaries=n \
    -y RG_dependencies=resource-group \
    [-h nodelist]
    -g resource-group

    Specifies the name of the scalable service resource group to add.

    -y Maximum_primaries=m

    Specifies the maximum number of active primary nodes allowed for this resource group. If you do not assign a value to this property, the default is 1.

    -y Desired_primaries=n

    Specifies the desired number of active primary nodes allowed for this resource group. If you do not assign a value to this property, the default is 1.

    -y RG_dependencies= resource-group

    Identifies the resource group that contains the shared address resource on which the resource group being created depends, that is, the name of the failover resource group that you created in Step 3.

    -h nodelist

    An optional list of nodes that can be primaries for this resource group. You only need to specify this list if some nodes cannot act as primaries for this resource group.

  7. For scalable services only – Create an application resource in the scalable resource group.

    If you run Sun Cluster HA for Apache as a failover data service, proceed to Step 8.


    # scrgadm -a -j resource -g resource-group \
    -t resource-type -y Network_resources_used=network-resource, … \
    -y Port_list=port-number/protocol[, …] -y Scalable=True \ 
    -x Bin_dir=bin-directory, ... 
    -j resource

    Specifies your choice for the name of the resource to add.

    -g resource-group

    Specifies the name of the scalable resource group into which the resources are to be placed.

    -t resource-type

    Specifies the type of the resource to add.

    -y Network_resources_used= network-resource, …

    Specifies a comma-separated list of network resource names that identify the shared addresses that the data service uses.

    -y Port_list=port-number/protocol, …

    Specifies a comma-separated list of port numbers and protocol to be used, for example, 80/tcp,81/tcp.

    -y Scalable=

    Specifies a required parameter for scalable services. This parameter must be set to True.

    -x Bin_dir=bin-directory

    Specifies the location where the Apache binaries—in particular, apachect1—are installed. Sun Cluster HA for Apache requires this extension property.


    Note –

    Optionally, you can set additional extension properties that belong to the Apache data service to override their default values. See Table 1–2 for a list of extension properties.


  8. For failover services only – Create an application resource in the failover resource group.

    Perform this step only if you run Sun Cluster HA for Apache as a failover data service. If you run Sun Cluster HA for Apache as a scalable data service, you should have performed Step 6 and Step 7 and should now proceed to Step 10.


    # scrgadm -a -j resource -g resource-group \
    -t resource-type -y Network_resources_used=network-resource, … \
    -y Port_list=port-number/protocol[, …] -y Scalable=False \ 
    -x Bin_dir=bin-directory
    
    -j resource

    Specifies your choice for the name of the resource to add.

    -g resource-group

    Specifies the name of the resource group into which the resources are to be placed, created in Step 3.

    -t resource-type

    Specifies the type of the resource to add.

    -y Network_resources_used= network-resource, …

    Specifies a comma-separated list of network resources that identify the shared addresses that the data service uses.

    -y Port_list=port-number/protocol, …

    Specifies a comma-separated list of port numbers and protocol to be used, for example, 80/tcp,81/tcp.

    -y Scalable=

    This property is required for scalable services only. Here the value is set to False or can be omitted.

    -x Bin_dir=bin-directory

    Specifies the location where the Apache binaries—in particular, apachect1—are installed. Sun Cluster HA for Apache requires this extension property.

  9. Bring the failover resource group online.


    # scswitch -Z -g resource-group
    
    -Z

    Enables the shared address resource and fault monitoring, switches the resource group into a MANAGED state, and brings the resource group online.

    -g resource-group

    Specifies the name of the failover resource group.

  10. For scalable services only – Bring the scalable resource group online.


    # scswitch -Z -g resource-group
    
    -Z

    Enables the resource and monitor, moves the resource group to the MANAGED state, and brings the resource group online.

    -g resource-group

    Specifies the name of the scalable resource group.

Example – Registering Scalable Sun Cluster HA for Apache

For scalable services, you create the following resource groups.

The following example shows how to register a scalable Apache service on a two-node cluster.


Cluster Information
Node names: phys-schost-1, phys-schost-2
Shared address: schost-1
Resource groups: resource-group-1 (for shared addresses), 
	resource-group-2 (for scalable Apache application 
    resources)
Resources: schost-1 (shared address), apache-1 (Apache application 
    resource)
 
(Add a failover resource group to contain shared addresses.)
# scrgadm -a -g resource-group-1
 
(Add the shared address resource to the failover resource group.)
# scrgadm -a -S -g resource-group-1 -l schost-1 
 
(Register the Apache resource type.)
# scrgadm -a -t SUNW.apache
 
(Add a scalable resource group.)
# scrgadm -a -g resource-group-2 -y Maximum_primaries=2 \
-y Desired_primaries=2 -y RG_dependencies=resource-group-1
 
(Add Apache application resources to the scalable resource group.)
# scrgadm -a -j apache-1 -g resource-group-2 \
-t SUNW.apache -y Network_resources_used=schost-1 \
-y Scalable=True -y Port_list=80/tcp \
-x Bin_dir=/opt/apache/bin
 
(Bring the failover resource group online.)
# scswitch -Z -g resource-group-1
 
(Bring the scalable resource group online on both nodes.)
# scswitch -Z -g resource-group-2

Example – Registering Failover Sun Cluster HA for Apache

The following example shows how to register a failover Apache service on a two-node cluster.


Cluster Information
Node names: phys-schost-1, phys-schost-2
Logical hostname: schost-1
Resource group: resource-group-1 (for all of the resources)
Resources: schost-1 (logical hostname),
	apache-1 (Apache application resource)
 
(Add a failover resource group to contain all of the resources.)
# scrgadm -a -g resource-group-1
 
(Add the logical hostname resource to the failover resource group.)
# scrgadm -a -L -g resource-group-1 -l schost-1 
 
(Register the Apache resource type.)
# scrgadm -a -t SUNW.apache
 
(Add Apache application resources to the failover resource group.)
# scrgadm -a -j apache-1 -g resource-group-1 \
-t SUNW.apache -y Network_resources_used=schost-1 \
-y Scalable=False -y Port_list=80/tcp \
-x Bin_dir=/opt/apache/bin
 
(Bring the failover resource group online.)
# scswitch -Z -g resource-group-1

Where to Go From Here

Use the information in How to Verify Data Service Installation and Configuration to verify the installation. See Configuring Sun Cluster HA for Apache Extension Properties to set or modify resource extension properties.

How to Configure SUNW.HAStoragePlus Resource Type

The SUNW.HAStoragePlus resource type was introduced in Sun Cluster 3.0 5/02. This new resource type performs the same functions as SUNW.HAStorage, and synchronizes actions between HA storage and the data service.

SUNW.HAStoragePlus also has an additional feature to make a local file system highly available.

See the SUNW.HAStoragePlus(5) man page and “Relationship Between Resource Groups and Disk Device Groups” in Sun Cluster Data Services Planning and Administration Guide for Solaris OS for background information. See “Synchronizing the Startups Between Resource Groups and Disk Device Groups” in Sun Cluster Data Services Planning and Administration Guide for Solaris OS for the procedure. (If you are using a Sun Cluster 3.0 version prior to 5/02, you must set up SUNW.HAStorage instead of SUNW.HAStoragePlus. See “Synchronizing the Startups Between Resource Groups and Disk Device Groups” in Sun Cluster Data Services Planning and Administration Guide for Solaris OS for the procedure.)

How to Verify Data Service Installation and Configuration

After you configure Sun Cluster HA for Apache, verify that you can open a web page with the network resources (logical hostnames or shared addresses) and port number from a web browser. Perform a switchover with the scswitch(1M) command to verify that the service continues to run on a secondary node and can be switched back to the original primary.