Sun Cluster 3.0 Data Services Installation and Configuration Guide

How to Register and Configure Sun Cluster HA for Apache

Run this procedure on any cluster member.

  1. Become superuser on a node in the cluster.

  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, it contains both network and failover application resources. For scalable services, it 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 fo-resource-group-name [-h nodelist]
    -a

    Adds a new configuration.

    -g fo-resource-group-name

    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 the nodes in the cluster are potential masters, you need not use the -h option.


  4. Verify that all network addresses that you are using have been added to your name service database.

    This verification should have been done as part of the Sun Cluster installation. For details, see the planning chapter in the Sun Cluster 3.0 Installation Guide.


    Note -

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


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


    # scrgadm -a {-S | -L} -g fo-resource-group-name \
    -l hostname, ... [-j resource-name] \
    [-X auxnodelist=nodeid, ...] [-n network-interface-id-list]
    -S | -L

    -S specifies shared address resources; -L specifies logical host name 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 fo-resource-group-name

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

    -j resource-name

    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 specified after the -l option.

    -X auxnodelist=nodeid, ...

    Specifies a comma-separated list of physical 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 network-interface-id-list

    Specifies an optional comma-separated list that identifies the NAFO groups on each node. All nodes in nodelist of the resource group must be represented in network-interface-list. If you do not specify this option, scrgadm attempts to discover a net adapter on the subnet identified by the hostname list for each node in nodelist.

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

    If you are running Sun Cluster HA for Apache as a failover data service, skip 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 as well as a dependency between this resource group and the failover resource group you created in Step 3. This dependency ensures that in the event of failover, 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 it.


    # scrgadm -a -g ss-resource-group-name \
    -y Maximum_primaries=m -y Desired_primaries=n \
    -y RG_dependencies=resource-group-name
    
    -g ss-resource-group-name

    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-name

    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 created in Step 3.

  7. Scalable services only: Create an application resource in the scalable resource group.

    If you are running Sun Cluster HA for Apache as a failover data service, skip to Step 8.


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

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

    -g ss-resource-group-name

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

    -t resource-type-name

    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 used by the data service.

    -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. Must be set to True.

    -x Confdir_list=config-directory, ...

    Specifies a comma-separated list of the locations of the Apache configuration files. This is a required extension property.

    -x Bin_dir=bin-directory

    Specifies the location where the Apache binaries are installed. This is a required extension property.


    Note -

    Optionally, you can set additional extension properties that belong to the Apache data service to override the default value. See Table 5-2 for a list of extension properties.


  8. Failover services only: Create an application resource in the failover resource group.

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


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

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

    -g resource-group-name

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

    -t resource-type-name

    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 used by the data service.

    -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 it is set to False or can be omitted.

    -x Confdir_list=config-directory

    Specifies the location of the Apache configuration file. This is a required extension property and must have exactly one entry only.

    -x Bin_dir=bin-directory

    Specifies the location where the Apache binaries are installed. This is a required extension property.

  9. Bring the failover resource group online.


    # scswitch -Z -g fo-resource-group-name
    
    -Z

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

    -g fo-resource-group-name

    Specifies the name of the failover resource group.

  10. Scalable services only: Bring the scalable resource group online.


    # scswitch -Z -g ss-resource-group-name
    
    -Z

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

    -g ss-resource-group-name

    Specifies the name of the scalable resource group.

Example-Registering Scalable Sun Cluster HA for Apache

For scalable services, you create two resource groups: a failover resource group that contains the network resources and a scalable resource group that contains the application resources. 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: sa-schost-1 (for shared addresses), 	ap-schost-1 (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 sa-schost-1
 
(Add the shared address resource to the failover resource group.)
# scrgadm -a -S -g sa-schost-1 -l schost-1 
 
(Register the Apache resource type.)
# scrgadm -a -t SUNW.apache
 
(Add a scalable resource group.)
# scrgadm -a -g ap-schost-1 -y Maximum_primaries=2 \
-y Desired_primaries=2 -y RG_dependencies=sa-schost-1
 
(Add Apache application resources to the scalable resource group.)
# scrgadm -a -j apache-1 -g ap-schost-1 \
-t SUNW.apache -y Network_resources_used=schost-1 \
-y Scalable=True -y Port_list=80/tcp \
-x Bin_dir=/opt/apache/bin -x Confdir_list=/opt/apache/conf
 
(Bring the failover resource group online.)
# scswitch -Z -g sa-schost-1
 
(Bring the scalable resource group online on both nodes.)
# scswitch -Z -g ap-schost-1

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: lh-schost-1 (for all resources)
Resources: schost-1 (logical hostname),	apache-1 (Apache application resource)
 
(Add a failover resource group to contain all resources.)
# scrgadm -a -g lh-schost-1
 
(Add the logical host name resource to the failover resource group.)
# scrgadm -a -L -g lh-schost-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 lh-schost-1 \
-t SUNW.apache -y Network_resources_used=schost-1 \
-y Scalable=False -y Port_list=80/tcp \
-x Bin_dir=/opt/apache/bin -x Confdir_list=/opt/apache/conf
 
(Bring the failover resource group online.)
# scswitch -Z -g lh-schost-1

Where to Go from Here

Verify the installation by using the information in the section "How to Verify Data Service Installation and Configuration". To set or modify resource extension properties, see "Configuring Sun Cluster HA for Apache Extension Properties".