16.5.3. Install the mod_cluster Module Into Apache HTTPD or JBoss Enterprise Web Server HTTPD

Prerequisites

  • To perform this task, you must be using Apache HTTPD installed in Red Hat Enterprise Linux 6, or JBoss Enterprise Web Server, or the stand-alone HTTPD included as a separate downloadable component of JBoss EAP 6.
  • If you need to install Apache HTTPD in Red Hat Enterprise Linux 6, use the instructions from the Red Hat Enterprise Linux 6 Deployment Guide, available from https://access.redhat.com/site/documentation/.
  • If you need to install the stand-alone HTTPD included as a separate downloadable component of JBoss EAP 6, refer to Section 16.3.2, “Install the Apache HTTPD included with JBoss EAP 6”.
  • If you need to install JBoss Enterprise Web Server, use the instructions from the JBoss Enterprise Web Server Installation Guide, available from https://access.redhat.com/site/documentation/.
  • Download the Webserver Connecter Natives package for your operating system and architecture from the Red Hat Customer Portal at https://access.redhat.com. This package contains the mod_cluster binary HTTPD modules precompiled for your operating system. After you extract the archive, the modules are located in the modules/native/lib/httpd/modules/ directory.
    The etc/ directory contains some example configuration files, and the share/ directory contains some supplemental documentation.
  • You must be logged in with administrative (root) privileges.

Procedure 16.5. Install the mod_cluster Module

  1. Determine your HTTPD configuration location.

    Your HTTPD configuration location will be different depending on whether you are using Red Hat Enterprise Linux's Apache HTTPD, the stand-alone HTTPD included as a separate downloadable component with JBoss EAP 6, or the HTTPD available in JBoss Enterprise Web Server. It is one of the following three options, and is referred to in the rest of this task as HTTPD_HOME.
    • Apache HTTPD - /etc/httpd/
    • JBoss EAP 6 HTTPD - This location is chosen by you, based on the requirements of your infrastructure.
    • JBoss Enterprise Web Server HTTPD - EWS_HOME/httpd/
  2. Copy the modules to the HTTPD modules directory.

    Copy the four modules (the files ending in .so) from the modules/native/lib/httpd/modules/ directory of the extracted Webserver Natives archive to the HTTPD_HOME/modules/ directory.
  3. For JBoss Enterprise Web Server, disable the mod_proxy_balancer module.

    If you use JBoss Enterprise Web Server, the mod_proxy_balancer module is enabled by default. It is incompatible with mod_cluster. To disable it, edit the HTTPD_HOME/conf/httpd.conf and comment out the following line by placing a # (hash) symbol before the line which loads the module. The line is shown without the comment and then with it, below.
    LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    # LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    Save and close the file.
  4. Configure the mod_cluster module.

    The Webserver Natives archive contains a sample mod_cluster.conf file (modules/system/layers/base/native/etc/httpd/conf). This file can be used as a guide or copied and edited to create a HTTPD_HOME/httpd/conf.d/JBoss_HTTP.conf file.

    Note

    Using the name JBoss_HTTP.conf is an arbitrary convention in this document. The configuration file will be loaded, regardless of its name, if it is saved in the conf.d/ directory with the .conf extension.
    Add the following to your configuration file:
    LoadModule slotmem_module modules/mod_slotmem.so
    LoadModule manager_module modules/mod_manager.so
    LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
    LoadModule advertise_module modules/mod_advertise.so
    
    This causes Apache HTTPD to automatically load the modules that mod_cluster needs in order to function.
  5. Create a proxy server listener.

    Continue editing HTTPD_HOME/httpd/conf.d/JBoss_HTTP.conf and add the following minimal configuration, replacing the values in capital letters with sensible ones for your system.
    Listen IP_ADDRESS:PORT
    <VirtualHost IP_ADDRESS:PORT>  
    	  <Location />
              Order deny,allow
              Deny from all
              Allow from *.MYDOMAIN.COM
    	  </Location>
    	  
    	  KeepAliveTimeout 60
    	  MaxKeepAliveRequests 0
    	  EnableMCPMReceive On
    	  
    	  ManagerBalancerName mycluster
    	  ServerAdvertise On
    	  
    </VirtualHost>
    
    These directives create a new virtual server which listens on IP_ADDRESS:PORT, allows connections from MYDOMAIN.COM, and advertises itself as a balancer called mycluster. These directives are covered in detail in the documentation for Apache Web Server. To learn more about the ServerAdvertise and EnableMCPMReceive directives, and the implications of server advertisement, refer to Section 16.5.4, “Configure Server Advertisement Properties for Your mod_cluster-enabled HTTPD”.
    Save the file and exit.
  6. Restart the HTTPD.

    The way to restart the HTTPD depends on whether you are using Red Hat Enterprise Linux's Apache HTTPD or the HTTPD included in JBoss Enterprise Web Server. Choose one of the two methods below.
    • Red Hat Enterprise Linux 6 Apache HTTPD

      Issue the following command:
      [root@host]# service httpd restart
    • JBoss Enterprise Web Server HTTPD

      JBoss Enterprise Web Server runs on both Red Hat Enterprise Linux and Microsoft Windows Server. The method for restarting the HTTPD is different for each.
      • Red Hat Enterprise Linux

        In Red Hat Enterprise Linux, JBoss Enterprise Web Server installs its HTTPD as a service. To restart the HTTPD, issue the following two commands:
        [root@host ~]# service httpd stop
        [root@host ~]# service httpd start
      • Microsoft Windows Server

        Issue the following commands in a command prompt with administrative privileges:
        C:\> net stop httpd
        C:\> net start httpd
Result

The Apache HTTPD is now configured as a load balancer, and can work with the mod_cluster subsystem running JBoss EAP 6. To configure JBoss EAP 6 to be aware of mod_cluster, refer to Section 16.5.5, “Configure a mod_cluster Worker Node”.