[Linux-HA] Two node HA v2 Apache2 + DRBD 8.2.4

Marco Leone marco.leone at eng.it
Tue Mar 4 04:32:24 MST 2008


Hi,

can anyone try to explain how can I modify this existing cib.xml to 
obtain a configuration where:

- Apache is started only in the node where drbd is master;
- Apache is started after the filesystem is mounted;

I guess I have to insert two more constraints:

1. order to start apache after filesystem is mounted;
2. location to start apache only where drbd is started;

Cib.xml follows:

  <cib admin_epoch="0" epoch="7" num_updates="1" generated="false" 
have_quorum="false" ignore_dtd="false" num_peers="0" 
cib_feature_revision="2.0" cib-last-written="Wed Oct 17 21:35:48 2007">
    <configuration>
      <crm_config>
        <cluster_property_set id="cib-bootstrap-options">
          <attributes>
            <nvpair id="cib-bootstrap-options-symmetric-cluster" 
name="symmetric-cluster" value="true"/>
            <nvpair id="cib-bootstrap-options-no-quorum-policy" 
name="no-quorum-policy" value="stop"/>
            <nvpair 
id="cib-bootstrap-options-default-resource-stickiness" 
name="default-resource-stickiness" value="0"/>
            <nvpair 
id="cib-bootstrap-options-default-resource-failure-stickiness" 
name="default-resource-failure-stickiness" value="0"/>
            <nvpair id="cib-bootstrap-options-stonith-enabled" 
name="stonith-enabled" value="false"/>
            <nvpair id="cib-bootstrap-options-stonith-action" 
name="stonith-action" value="reboot"/>
            <nvpair id="cib-bootstrap-options-startup-fencing" 
name="startup-fencing" value="true"/>
            <nvpair id="cib-bootstrap-options-stop-orphan-resources" 
name="stop-orphan-resources" value="true"/>
            <nvpair id="cib-bootstrap-options-stop-orphan-actions" 
name="stop-orphan-actions" value="true"/>
            <nvpair id="cib-bootstrap-options-remove-after-stop" 
name="remove-after-stop" value="false"/>
            <nvpair id="cib-bootstrap-options-short-resource-names" 
name="short-resource-names" value="true"/>
            <nvpair id="cib-bootstrap-options-transition-idle-timeout" 
name="transition-idle-timeout" value="5min"/>
            <nvpair id="cib-bootstrap-options-default-action-timeout" 
name="default-action-timeout" value="20s"/>
            <nvpair id="cib-bootstrap-options-is-managed-default" 
name="is-managed-default" value="true"/>
            <nvpair id="cib-bootstrap-options-cluster-delay" 
name="cluster-delay" value="60s"/>
            <nvpair id="cib-bootstrap-options-pe-error-series-max" 
name="pe-error-series-max" value="-1"/>
            <nvpair id="cib-bootstrap-options-pe-warn-series-max" 
name="pe-warn-series-max" value="-1"/>
            <nvpair id="cib-bootstrap-options-pe-input-series-max" 
name="pe-input-series-max" value="-1"/>
            <nvpair id="cib-bootstrap-options-dc-version" 
name="dc-version" value="2.1.3-node: 
552305612591183b1628baa5bc6e903e0f1e26a3"/>
          </attributes>
        </cluster_property_set>
      </crm_config>
      <nodes>
        <node id="4a1ce1a4-43e8-4025-a96f-dfe102d1eb15" uname="rugws02" 
type="normal"/>
        <node id="b7e11684-0dc5-4c65-9e47-4b82387fbefe" uname="rugws01" 
type="normal"/>
      </nodes>
      <resources>
        <group id="group_1">
          <primitive class="ocf" id="IPaddr_192_168_100_12" 
provider="heartbeat" type="IPaddr">
            <operations>
              <op id="IPaddr_192_168_100_12_mon" interval="5s" 
name="monitor" timeout="5s"/>
            </operations>
            <instance_attributes id="IPaddr_192_168_100_12_inst_attr">
              <attributes>
                <nvpair id="IPaddr_192_168_100_12_attr_0" name="ip" 
value="192.168.100.12"/>
              </attributes>
            </instance_attributes>
          </primitive>
          <primitive class="ocf" id="apache_2" provider="heartbeat" 
type="apache">
            <operations>
              <op id="apache_2_mon" interval="120s" name="monitor" 
timeout="60s"/>
            </operations>
            <instance_attributes id="apache_2_inst_attr">
              <attributes>
                <nvpair id="apache_2_attr_0" name="configfile" 
value="/etc/apache2/apache2.conf"/>
              </attributes>
            </instance_attributes>
          </primitive>
        </group>
        <master_slave id="ms-drbd0">
          <meta_attributes id="ma-ms-drbd0">
            <attributes>
              <nvpair id="ma-ms-drbd0-1" name="clone_max" value="2"/>
              <nvpair id="ma-ms-drbd0-2" name="clone_node_max" value="1"/>
              <nvpair id="ma-ms-drbd0-3" name="master_max" value="1"/>
              <nvpair id="ma-ms-drbd0-4" name="master_node_max" value="1"/>
              <nvpair id="ma-ms-drbd0-5" name="notify" value="yes"/>
              <nvpair id="ma-ms-drbd0-6" name="globally_unique" 
value="false"/>
              <nvpair id="ma-ms-drbd0-7" name="target_role" 
value="#default"/>
            </attributes>
          </meta_attributes>
          <primitive id="drbd0" class="ocf" provider="heartbeat" 
type="drbd">
            <instance_attributes id="ia-drbd0">
              <attributes>
                <nvpair id="ia-drbd0-1" name="drbd_resource" value="drbd0"/>
              </attributes>
            </instance_attributes>
          </primitive>
        </master_slave>
        <primitive class="ocf" provider="heartbeat" type="Filesystem" 
id="fs0">
          <meta_attributes id="ma-fs0">
            <attributes>
              <nvpair name="target_role" id="ma-fs0-1" value="#default"/>
            </attributes>
          </meta_attributes>
          <instance_attributes id="ia-fs0">
            <attributes>
              <nvpair id="ia-fs0-1" name="fstype" value="ext2"/>
              <nvpair id="ia-fs0-2" name="directory" value="/shared-www"/>
              <nvpair id="ia-fs0-3" name="device" value="/dev/drbd0"/>
            </attributes>
          </instance_attributes>
        </primitive>
      </resources>
      <constraints>
        <rsc_location id="rsc_location_group_1" rsc="group_1">
          <rule id="prefered_location_group_1" score="100">
            <expression attribute="#uname" 
id="prefered_location_group_1_expr" operation="eq" value="node01"/>
          </rule>
        </rsc_location>
        <rsc_order id="drbd0_before_fs0" from="fs0" action="start" 
to="ms-drbd0" to_action="promote"/>
        <rsc_colocation id="fs0_on_drbd0" to="ms-drbd0" to_role="master" 
from="fs0" score="infinity"/>
      </constraints>
    </configuration>
  </cib>

-- 

Marco


More information about the Linux-HA mailing list