Go to main content

Oracle® Solaris Cluster Data Service for Apache Guide

Exit Print View

Updated: August 2018
 
 

Planning the Installation and Configuration

Before you install HA for Apache, update the following information in the Apache configuration file httpd.conf.


Note -  The location of the httpd.conf file varies according to installation. System administrators typically install the httpd.conf file on the cluster file system. When installing the Apache package bundled with Oracle Solaris, the file is located in the /etc/apache2/2.2 directory.
  • The ServerName directive that contains the hostname – For HA for Apache to be highly available, you must set this directive to the name of the network address (logical hostname or shared address) that is used to access the server. You should have set up the logical hostname or shared address when you installed the cluster. See the Concepts for Oracle Solaris Cluster 4.4 for details on network resources.

  • The BindAddress directive, which you must set to the logical host or shared address – You can configure Apache to bind to INADDR_ANY. However, each resource must bind to a unique combination of network resource and port number. For example, if you run multiple resources, you can use INADDR_ANY provided that the port number for each resource is different.

  • The ServerType directive – This directive must be set to standalone, the default.

  • Multiple instances of Apache – If you have multiple instances of Apache, you must manage each instance with a separate resource. Furthermore, each separate resource must have a unique Bin_dir setting. Under the specified Bin_dir property that starts the particular instance of Apache, an apachectl script must exist.


    Note -  Different Apache resources can share the same httpd binary, that is, the apachectl scripts for different resources can specify the path to the same httpd binary. However, you must modify each apachectl script to use a different configuration file for specific Apache resources. To do so, use the -f option of the httpd command to specify a specific httpd.conf file.
  • The DocumentRoot directive that specifies the location of the documentation root directory – This directive is a pointer to a location on the cluster file system, where the HTML documents are installed.

  • The ScriptAlias directive that contains the location on a cluster file system of the cgi-bin directory – This directive is a pointer to a location on the cluster file system, where the cgi-bin files are installed.


    Note -  You must follow certain conventions when you configure URL mappings for the web server. For example, when setting the CGI directory, locate the CGI directory on the cluster file system to preserve availability. For example, you might map your CGI directory to /global/diskgroup/ServerRoot/cgi-bin, where diskgroup is the disk device group that contains the Apache software. In situations where the CGI programs access "back-end" servers, such as an RDBMS, ensure that the Oracle Solaris Cluster software controls the "back-end" server. If the server is an RDBMS that the Oracle Solaris Cluster software supports, use one of the highly available RDBMS packages. Alternatively, you can use the APIs that the Developing Data Services explains to put the server under Oracle Solaris Cluster control.
  • The lock file – If you use a lock file, set the value of the LockFile directive in your httpd.conf file to a local file.

  • The PidFile directive – Point this directive to a local file, as in the following example:

    PidFile /local/apache/log/httpd.pid

    Note -  While using Apache 2.2 with HA for Apache, ensure that the directory to which the PidFile directive in the configuration file references exists and proper permissions are assigned. Before you install the HA for Apache package, verify that the Apache software is properly installed and configured to run on a cluster.

    In Apache 2.2, the PidFile directive can be modified to point to /local/apache/log/httpd.pid. Since this directory does not exist by default, you are required to create it manually or the resource will not start.


  • The Port directive setting that the server port or ports access – The defaults are set in each node's httpd.conf file. The Port_list resource property must include all of the ports that the httpd.conf files specify.

    The Port_list property assumes that the web server serves all combinations of ports and IP addresses from the network resources as defined in the resource_dependencies property.

    Port_list="80/tcp,443/tcp,8080/tcp"

    The preceding Port_list configuration, for example, probes the following IP-port combinations.

    Host
    Port
    Protocol
    phys-schost-1
    80
    tcp
    phys-schost-1
    443
    tcp
    phys-schost-1
    8080
    tcp
    phys-schost-2
    80
    tcp
    phys-schost-2
    443
    tcp
    phys-schost-2
    8080
    tcp

    However, if phys-schost-1 serves ports 80 and 443 only and phys-schost-2 serves ports 80 and 8080 only, you can configure the Port_list property for Apache as follows:

    Port_list=phys-schost-1/80/tcp,phys-schost-1/443/tcp,
    phys-schost-2/80/tcp,phys-schost-2/8080/tcp

    Consider the following rules.

    • You must specify hostnames or IP addresses (not network resource names) for phys-schost-1 and phys-schost-2.

    • If Apache serves phys-schost-N/port for every phys-schost-N in the resource_dependencies property, you can use a short form to replace the combination of, for example, phys-schost-1/port1, phys-schost-2/port2, and so on. See the following examples.

      Example One

      Port_list="80/tcp,phys-schost-1/443/tcp,phys-schost-2/8080/tcp"
      resource_dependencies=phys-schost-1,phys-schost-2

      This example probes the following IP-port combinations.

      Host
      Port
      Protocol
      phys-schost-1
      80
      tcp
      phys-schost-1
      443
      tcp
      phys-schost-2
      80
      tcp
      phys-schost-2
      8080
      tcp

      Example Two

      Port_list="phys-schost-1/80/tcp,phys-schost-2/80/tcp"
      resource_dependencies=net-1,net-2
      #net-1 contains phys-schost-1.
      #net-2 contains phys-schost-2 and phys-schost-3.

      This example probes the following IP-port combinations.

      Host
      Port
      Protocol
      phys-schost-1
      80
      tcp
      phys-schost-2
      80
      tcp
    • All of the hostnames (IP addresses) that the Port_list property specifies must not belong to a network resource that is specified in any other scalable resource's Resource_dependencies property. Otherwise, as soon as a scalable service detects that another scalable resource already uses an IP address, creation of the Apache resource fails.


      Note -  The Apache resource can use an already created shared address resource provided they listen to a port or port list that is not being used on that shared address.
  • Apache Proxy Server – Add the following lines of code to the httpd.conf 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.

    You can add the following lines to the httpd.conf to configure Apache HTTPS. This is a simple configuration for illustration purposes. Refer to Apache documentation for all details.

    ...  
    LoadModule ssl_module modules/mod_ssl.so 
           
    Listen 443  
    <VirtualHost logical-host:443>  
    ServerName logical-host.example.com  
    SSLEngine on  
    SSLCertificateFile /global/apache/conf/ssl/server.crt  
    SSLCertificateKeyFile /global/apache/conf/ssl/server.key  
    </VirtualHost>  
    ...

Note -  If you run HA for Apache and another HTTP server, configure the HTTP servers to listen on different ports. Otherwise, a port conflict can occur between the two servers.

To register and configure HA for Apache, you must consider or provide information on the following points.

  • Decide whether to run HA for Apache as a failover or scalable data service.

  • Decide which fault monitoring resource properties to set. In most cases, the default values suffice. See the Planning and Administering Data Services for Oracle Solaris Cluster 4.4 for information about the standard properties and HA for Apache Extension Properties for information about the extension properties.

  • Provide the name of the resource type for HA for Apache. This name is SUNW.apache.

  • Provide the names of the cluster nodes that will master the data service.

  • Provide the logical hostname (failover services) or shared address (scalable services) that clients use to access the data service. You typically set up this IP address when you install the cluster. See the Concepts for Oracle Solaris Cluster 4.4 for details on network resources.

  • Provide the path to the application binaries. You can install the binaries on the local disks or on the cluster file system. See Configuration Guidelines for Oracle Solaris Cluster Data Services in Planning and Administering Data Services for Oracle Solaris Cluster 4.4 for a discussion of the advantages and disadvantages of each location.

  • Modify each copy of apachectl to use the appropriate httpd.conf configuration file.

  • Exercise caution when you change the Load_balancing_weights property for an online scalable service that has the Load_balancing_policy property set to LB_STICKY or LB_STICKY_WILD. Changing these properties while the service is online can cause existing client affinities to be reset, hence a different node might service a subsequent client request even if another cluster member previously serviced the client.

    Similarly, when a new instance of the service is started on a cluster, existing client affinities might be reset.

  • Determine the entry for the Port_list property. The Port_list property can have multiple entries. See How to Register and Configure HA for Apache Using Oracle Solaris Cluster Command Line Interface (CLI) for details.

  • Determine whether to utilize the Monitor_Uri_List extension property. This extension property enables you to monitor an arbitrary list of URIs. Arbitrary monitoring of URIs is beneficial if you require the HA for Apache agent probe to monitor any applications (URIs) deployed on the HA for Apache server. Use of the Monitor_Uri_List extension property is not supported with HTTP instances of HA for Apache. See Monitoring Arbitrary URIs for detailed information about using the Monitor_Uri_List extension property.