[DRBD-user] The Elegant Way to Include a Master-Slave into a Group? + Please help me double-check this CIB

Luis Motta Campos luismottacampos at yahoo.co.uk
Thu Mar 27 17:35:28 CET 2008

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


  Hi List People. :)

  I wonder if someone here had the same issue before, and can point me
to an elegant solution:

  I have 4 resources that must run under the same machine: a DRBD file
system (a Master-Slave resource); a Mount-Point for it on my System; a
MySQL database (using the mounted file system); and an IP address (so my
users can reach the database).

  Following the suggestion in the V2 how-to, I'm implementing a <group>
in order to enable all the resources to be activated in the right order
and all in the same machine without going mad writing configuration rules.

  But the CIB DTD doesn't allows me to have a Master-Slave set inside a
<group> tag, and I wonder if there is an elegant way to stablish the
connection.

  I would love if one of you could please check that I'm not writing
bullshit before I put this to production.

----- BEGIN XML -----
<resources>
    <master_slave id="database-disk">
        <meta_attributes>
            <attributes>
                <nvpair name="clone_max" value="2"/>
                <nvpair name="clone_node_max" value="1"/>
                <nvpair name="master_max" value="1"/>
                <nvpair name="master_node_max" value="1"/>
                <nvpair name="notify" value="yes"/>
                <nvpair name="globally_unique" value="false"/>
                <nvpair name="target_role" value="#default"/>
            </attributes>
        </meta_attributes>
        <primitive id="database-storage-drbd" class="ocf"
provider="heartbeat" type="drbd">
            <instance_attributes>
                <attributes>
                    <nvpair name="drbd_resource" value="database-storage"/>
                </attributes>
            </instance_attributes>
        </primitive>
    </master_slave>

    <group id="db-cluster-service">

        <primitive id="database-filesystem" class="ocf"
provider="heartbeat" type="Filesystem">
            <meta_attributes>
                <attributes>
                    <nvpair name="target_role" value="#default"/>
                </attributes>
            </meta_attributes>
            <instance_attributes id="ia-fs0">
                <attributes>
                    <nvpair name="fstype" value="ext3"/>
                    <nvpair name="directory" value="/var/data"/>
                    <nvpair name="device" value="/dev/drbd0"/>
                </attributes>
            </instance_attributes>
        </primitive>

        <primitive id="database-server" class="ocf" type="mysql"
provider="heartbeat">
            <instance_attributes>
                <attributes>
                    <nvpair name="mysql_config" value="/etc/my.cnf"/>
                    <nvpair name="mysql_datadir" value="/var/data"/>
                    <nvpair name="mysql_user" value="mysql"/>
                    <nvpair name="mysql_group" value="mysql"/>
                    <nvpair name="mysql_testtable" value="mysql.Users"/>
                </attributes>
            </instance_attributes>
        </primitive>

        <primitive id="database-master-ip" class="ocf" type="IPaddr"
provider="heartbeat">
            <instance_attributes>
                <attributes>
                    <nvpair name="ip" value="193.0.19.36"/>
                    <nvpair name="netmask" value="255.255.255.0"/>
                    <nvpair name="nic" value="eth0"/>
                </attributes>
            </instance_attributes>
        </primitive>

    </group>
</resources>

<constraints>
    <rsc_order id="disk-before-dbservice" action="start"
from="database-disk" type="before" to_action="promote"
to="db-cluster-service"/>
    <rsc_colocation id="disk-and-dbservice-together"
from="db-cluster-service" to="database-disk" to_role="master"
score="INFINITY"/>
</contraints>
-----  END XML  -----

  Any feedback is welcome. :)

  Many thanks in advance.
  Kind regards.
-- 
Luis Motta Campos (a.k.a. Monsieur Champs) is a software engineer,
Perl fanatic evangelist, and amateur {cook, photographer}




More information about the drbd-user mailing list