Linux-HA Logo

Two Apache Web Servers in an Active/Active Configuration

This configuration is for a high-availability server which provides two IP addresses (1.2.3.4, and 1.2.3.5) to be failed over[1] between the node[2]s of our cluster[3], and an Apache server for each IP address. We will set this up as an active/active[4] configuration.

Version 1 Configuration in /etc/ha.d/haresources

paul    1.2.3.4  apache::/apache1dir/httpd.cf
silas   1.2.3.5  apache::/apache2dir/httpd.cf

Version 2 Configuration in /var/lib/heartbeat/crm/cib.xml

<cib>
  <configuration>
    <crm_config/>
    <nodes/>
    <resources>
      <group id="apache_group_1">
        <primitive id="ip_resource_1" class="ocf" type="IPaddr" provider="heartbeat">
          <instance_attributes>
            <attributes>
              <nvpair name="ip" value="1.2.3.4"/>
            </attributes>
          </instance_attributes>
        </primitive>
        <primitive id="apache" class="heartbeat" type="apache">
          <instance_attributes>
            <attributes>
              <nvpair name="1" value="/apache1dir/httpd.cf"/>
            </attributes>
          </instance_attributes>
        </primitive>
      </group>
      <group id="apache_group_2">
        <primitive id="ip_resource_2" class="ocf" type="IPaddr" provider="heartbeat">
          <instance_attributes>
            <attributes>
              <nvpair name="ip" value="1.2.3.5"/>
            </attributes>
          </instance_attributes>
        </primitive>
        <primitive id="apache" class="heartbeat" type="apache">
          <instance_attributes>
            <attributes>
              <nvpair name="1" value="/apache2dir/httpd.cf"/>
            </attributes>
          </instance_attributes>
        </primitive>
      </group>
    </resources>
    <constraints>
      <rsc_location id="run_apache_group_1" rsc="apache_group_1">
        <rule id="pref_run_apache_group_1" score="100">
          <expression attribute="#uname" operation="eq" value="paul"/>
        </rule>
      </rsc_location>
      <rsc_location id="run_apache_group_2" rsc="apache_group_2">
        <rule id="pref_run_apache_group_2" score="100">
          <expression attribute="#uname" operation="eq" value="silas"/>
        </rule>
      </rsc_location>
    </constraints>
  </configuration>
  <status/>
</cib>

Explanation

See Also

GettingStarted/TwoApaches[5]


References

[1]http://en.wikipedia.org/wiki/Failover
[2]http://www.linux-ha.org/node
[3]http://en.wikipedia.org/wiki/Computer_cluster
[4]http://www.linux-ha.org/ActiveActive
[5]http://www.linux-ha.org/GettingStarted/TwoApaches


This information provided courtesy of the Linux-HA project at http://linux-ha.org/