Apache Web Server supports multiple instances of the httpd daemon running at the same time. Each LifeKeeper Apache Web Server hierarchy corresponds to a separate Apache instance with its own “server root” directory. Each instance may support one or more web sites, depending on whether or not it has been configured to use “virtual hosts.”
Primarily, the server root directory defines an Apache Web Server instance, since this directory will contain the conf/httpd.conf configuration file that specifies how the web instance is configured. The Apache configuration directives within this file will determine where the log files, web documents, other configuration files, etc. are located for the instance, as well as which IP and/or domain name addresses will be used.
It is useful to characterize Apache Web Server configurations with LifeKeeper based on whether or not a LifeKeeper file system (which uses shared storage) will be used. A single shared file system may be used for the server root directory (along with the configuration file conf/httpd.conf) and/or the document root directories (and optionally the httpd executable itself). Whether you choose to use a local or a shared configuration for a particular Apache instance will depend on two main factors: the difficulty of maintaining separate, identical copies of the configuration files and/or web site documents, and the availability and accessibility of storage which can be shared (or mirrored) between two or more servers. Note, however, that you may choose to configure both local and shared Apache instances on the same servers.
The following sections provide examples of Local and Shared Apache Web Server configurations in a LifeKeeper environment and summarize the main characteristics of each.
Local Configuration
In a typical local configuration, nothing is shared between the servers. Identical copies of the Apache Web Server configuration file, web documents, DSO modules (and their configuration files, if any), and the httpd executable reside in exactly the same locations on each server. It is the responsibility of the Apache administrator to maintain identical copies of the Apache components on the different servers.
Each web site is assigned an IP address – or a domain address that maps to a particular IP address – through the configuration file, and a LifeKeeper IP address is created for each and added to the Apache resource hierarchy. When the Apache hierarchy is switched over from one server to another, this particular httpd instance is stopped and the IP addresses are deactivated on the first server, then the IP addresses are reactivated and the instance started on the other server. Clients will then be automatically connected via TCP/IP to the identical web site on the other server.
Figure 1. Local Configuration
Configuration Notes:
- Figure 1 is an example of a local configuration where nothing is on a shared file system.
- Each server has the same version of the Apache Web Server executable at the same location (typically /usr/bin/httpd).
- Each server has the same server root directory where identical copies of the configuration file for each instance are placed.
- Each server has the same document root directory(s) where identical copies of the web document for each instance are placed.
- If DSO modules are being used, each server has identical copies at the same location.
Creating an Apache Web Server resource hierarchy on Server 1:
Server: | Server 1 |
Web Server Binary Location: | /usr/sbin/httpd |
Web Server Root Directory: | /home/www/examples/instance1/ |
Root Tag | apache-www.examples.instance1 |
Extending an Apache Web Server resource hierarchy to Server 2:
Template Server: | Server 1 |
Tag to Extend | apache-www.examples.instance1 |
Target Server | Server2 |
Target Priority: | 10 |
Note that when an Apache resource hierarchy is extended to one or more additional servers, the same Web Server Binary Location and Web Server Root Directory must be used on all servers, regardless of whether this is a local or a shared configuration. See the discussion above and the section on Specific Configuration Considerations for Apache Web Server for additional information. Also during hierarchy extension, LifeKeeper extends all the dependent resources which are part of the Apache resource hierarchy.
Shared Configuration
In a typical shared configuration, the server root directory and the document root directories are all on the same shared file system. The same configuration file and web documents are shared between the servers, so there is no need to maintain identical copies on each server. If DSO modules are being used, they also can be located on the same shared file system, along with any configuration files or resources they may need.
Note that you may choose to place only the web documents on a shared file system. This will still appear much like a typical local configuration, since the server root directories will be local, but the hierarchy will also include a shared file system.
If you wish to use a particular version or a separate copy of the Apache executable for this Apache resource hierarchy, you may place this executable on the shared file system as well and it will be available only to this instance. To do this, simply enter the full path of the httpd executable on the shared file system when prompted for the Web Server Binary Location.
Note that only one shared file system may be used, since this assures that all required components which are on shared storage will be available at the same time. If you choose to use a Web Server Binary Location on a shared file system, you must also choose a Web Server Root Directory on the same shared file system, and all DocumentRoot directories configured for this server root must be on the same shared file system. Likewise, when you choose a Web Server Root Directory on a shared file system, all DocumentRoot directories must be on the same shared file system. If neither the binary nor the server root is placed on a shared file system, but any of the DocumentRoot directories are shared, all DocumentRoot directories must be shared on the same file system.
These rules can be summarized as follows:
- If the Apache executable is shared, then the server root directory must be shared.
- If the server root directory is shared, then all DocumentRoot directories must be shared.
- If any DocumentRoot directory is shared, they must all be shared.
- Only one shared file system is allowed for each Apache resource hierarchy.
Figure 2. Shared Configuration
Configuration Notes:
- Figure 2 is an example of a shared configuration with shared configuration files and web documents.
- You may choose to place only the web documents on a shared file system. This will still appear much like a typical local configuration, except that the hierarchy will also include a shared file system.
- If DSO modules are used, they may reside on the shared file system, along with any configuration files or resources they need.
Creating an Apache Web Server resource hierarchy on Server 1:
Server: | Server1 |
Web Server Binary Location: | /usr/sbin/httpd …..OR…. /shared/example/instance2/bin/httpd |
Web Server Root Directory: | /shared/example/instance2 |
Root Tag | apache-shared.example.instance2 |
Extending an Apache Web Server resource hierarchy to Server 2:
Template Server: | Server1 |
Tag to Expand | apache-shared.example.instance2 |
Target Server | Server2 |
Target Priority: | 10 |
Post your comment on this topic.