Go to main content

Oracle® Solaris Cluster Data Service for Apache Guide

Exit Print View

Updated: September 2015
 
 

How to Register and Configure HA for Apache Using Oracle Solaris Cluster Command Line Interface (CLI)

Complete the registration and configuration on any cluster member.

Before You Begin

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

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


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

    /usr/sbin/svccfg –s svc:/system/name-service/switch setprop config/host = astring: \” cluster files nis\”


  • Ensure that the /etc/netmasks file has IP-address subnet and netmask entries for all logical hostnames. If necessary, edit the /etc/netmasks file to add any missing entries.

  1. Update the httpd.conf configuration file.
    • Set the ServerName directive. (In Version 2.2 of Apache, the ServerName directive specifies the hostname and the port.)

    • Set the BindAddress directive (optional). (The BindAddress directive only exists in versions prior to Apache 2.2. For Apache 22, see the following bullet for the Listen directive.)

    • Set the Listen directive. The Listen directive must use the address of the logical host or shared address. (The Listen directive only exists in Apache 2.2 and beyond. For Apache versions prior to Apache 2.2, see the previous bullet for the BindAddress directive.)

    • Set the ServerType, ServerRoot, DocumentRoot, ScriptAlias, and LockFile directives.


      Note -  The ServerType directive does not exist in Apache 2.2.
    • Set the Port directive to the same number as the Port_list standard resource property.

    • Add the following lines of code to the httpd.conf configuration file if you choose to configure the Apache software as a proxy server.

      # Proxy Server Directives.
      <IfModule mod_proxy.c>
      ProxyRequests On
      <Directory proxy:*>
      Order deny,allow
      Deny from all
      Allow from IP_ADDRESS
      </Directory>
      ProxyVia On
      </IfModule>
      # End of Proxy Server Directives.

      Note -  If you configure the Apache software as a proxy server, the CacheRoot setting must point to a location on the cluster file system.
  2. Verify that the port number or numbers in the httpd.conf file match those of the Port_list standard resource property.

    You can edit the httpd.conf configuration file to change its port number or numbers to match the standard Oracle Solaris Cluster resource property default (port 80). Alternatively, while you configure Oracle Solaris Cluster HA for Apache, you can set the Port_list standard property to match the setting in the httpd.conf file.

  3. Update the paths in the Apache start/stop script file (Bin_dir/apachectl).

    You must change the paths from the Apache defaults to match your Apache directory structure. For example, change the line in the BIN_dir/apachectl script beginning with HTTPD=/usr/local/apache/bin/httpd to the following.

    HTTPD='/usr/local/apache/bin/httpd -f /global/foo/apache/conf/httpd.conf'
  4. Perform the following tasks to verify your configuration changes.
    1. Run apachectl configtest to check the Apache httpd.conf file for correct syntax.
    2. Ensure that any logical hostnames or shared addresses that Apache uses are configured and online.
    3. Issue apachectl start to manually start your Apache server.

      If Apache does not start up correctly, correct the problem.

    4. After Apache has started, stop it before moving to the next procedure.
  5. On a cluster member, become an administrator that provides solaris.cluster.admin authorization.
  6. Register the SUNW.apache resource type for the data service.
    # clresourcetype register SUNW.apache
  7. 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 –n option.

    # clresourcegroup create [-n node-list] resource-group
    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.

    [–n node-list]

    Specifies a comma-separated, ordered list of nodes that can master this resource group. In this format, node specifies the node name in a global zone.

    This list is optional. If you omit this list, the global zone of each cluster node can master the resource group.

  8. Add a network resource, such as logical hostname or shared address, to the failover resource group that you created in Step 7.
    # clressharedaddress create -g resource-group \
    -h hostname,... [-N netiflist] resource
    –h hostname,…

    Specifies a comma-separated list of network resources to add.

    resource-group

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

    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 –h option.

    –N netiflist

    Specifies an optional, comma-separated list that identifies the IPMP groups that are on each node or zone. The format of each entry in the list is netif@node. The replaceable items in this format are as follows:

    netif

    Specifies an IPMP group name, such as sc_ipmp0, or a public network interface card (NIC). If you specify a public NIC, Oracle Solaris Cluster attempts to create the required IPMP groups.

    node

    Specifies the name or ID of a node. To specify the global zone, specify only node.


    Note -  If you require a fully qualified hostname, you must specify the fully qualified name with the -h option and you cannot use the fully qualified form in the resource name.

    Note -  Oracle Solaris Cluster does not currently support using the adapter name for netif.
  9. For scalable services only – Create a scalable resource group to run on all of the desired cluster nodes.

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

    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 -n 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 7. 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.

    # clresourcegroup create [-n node-zone-list] \
    -p Maximum_primaries=m -p Desired_primaries=n \
    -p RG_dependencies=resource-group resource-group
    resource-group

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

    –p 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.

    –p 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.

    –p 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 7.

    –n node- list

    Specifies a comma-separated, ordered list of nodes that can master this resource group. The format of each entry in the list is node. In this format, node specifies the node name . To specify the global zone, specify only node.

    This list is optional. If you omit this list, the global zone of each cluster node can master the resource group.

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

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

    # clresource create -g resource-group \
    -t resource-type -p Bin_dir=bin-directory,... \
    -p Resource_dependencies=network-resource,… \
    -p Port_list=port-number/protocol[, …] \
    -p Scalable=True resource
    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.

    –p Resource_dependencies= network-resource, …

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

    –p Port_list=port-number/protocol, …

    Specifies a comma-separated list of port numbers and protocol to be used, for example, 80/tcp,81/tcp. Specify HTTPS or HTTP ports being served by the Apache server.

    –p Scalable=

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

    –p Bin_dir=bin-directory

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

    The resource is created in the enabled state.


    Note -  Optionally, you can set additional extension properties that belong to the HA for Apache data service to override their default values. See Appendix A, HA for Apache Extension Properties for a list of extension properties.
  11. For failover services only – Create an application resource in the failover resource group.

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

    # clresource create -g resource-group \
    -t resource-type -p Bin_dir=bin-directory \
    -p Resource_dependencies=network-resource,… \
    -p Port_list=port-number/protocol[, …] resource
    resource

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

    –g resource-group

    Specifies the name of the resource group you created in Step 7 where the resources are to be placed.

    –t resource-type

    Specifies the type of the resource to add.

    –p Resource_dependencies= network-resource, …

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

    –p Port_list=port-number/protocol, …

    Specifies a comma-separated list of port numbers and protocol to be used (for example, 80/tcp,81/tcp). Specify HTTPS or HTTP ports being served by the Apache server.

    –p Scalable=

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

    –p Bin_dir=bin-directory

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

    The resource is created in the enabled state.

  12. Bring the failover resource group online.
    # clresourcegroup online -M resource-group
    resource-group

    Specifies the name of the failover resource group.

  13. For scalable services only – Bring the scalable resource group online.
    # clresourcegroup online -M resource-group
    resource-group

    Specifies the name of the scalable resource group.

Example 3  Registering Scalable HA for Apache

For scalable services, you create the following resource groups.

  • A failover resource group that contains the network resources

  • 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.

Ensure that the /etc/netmasks file has IP-address subnet and netmask entries for all logical hostnames. If necessary, edit the /etc/netmasks file to add any missing entries.

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.)
# clresourcegroup create resource-group-1
 
(Add the shared address resource to the failover resource group.)
# clressharedaddress create -g resource-group-1 -h schost-1 schost-1 
 
(Register the Apache resource type.)
# clresourcetype register SUNW.apache
 
(Add a scalable resource group.)
# clresourcegroup create -p Maximum_primaries=2 \
-p Desired_primaries=2 -p RG_dependencies=resource-group-1 resource-group-2
 
(Add Apache application resources to the scalable resource group.)
# clresource create -g resource-group-2 \
-t SUNW.apache -p Bin_dir=/opt/apache/bin -p Resource_dependencies=schost-1 \
-p Scalable=True \
-p Port_list=80/tcp apache-1
 
(Bring the failover resource group online.)
# clresourcegroup online -M resource-group-1
 
(Bring the scalable resource group online on both nodes.)
# clresourcegroup online -M resource-group-2
Example 4  Registering Failover HA for Apache

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

Ensure that the /etc/netmasks file has IP-address subnet and netmask entries for all logical hostnames. If necessary, edit the /etc/netmasks file to add any missing entries.

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.)
# clresourcegroup create resource-group-1
 
(Add the logical hostname resource to the failover resource group.)
# clreslogicalhostname create -g resource-group-1 -h schost-1 schost-1 
 
(Register the Apache resource type.)
# clresourcetype register SUNW.apache
 
(Add Apache application resources to the failover resource group.)
# clresource create -g resource-group-1 \
-t SUNW.apache -p Bin_dir=/opt/apache/bin -p Resource_dependencies=schost-1 \
-p Port_list=80/tcp apache-1
 
(Bring the failover resource group online.)
# clresourcegroup online -M resource-group-1