Pacemaker monitoring mysql

I have Pacemaker+Corosync set up to manage a shared IP address between two Mysql boxes in Master-Master/Active-Passive setup (using interleaved primary keys).

I have Pacemaker set up to manage the shared IP between the two machines, however, it currently only migrates the IP when a node is down rather than when there is a problem with mysql. I would like the IP to fail over automatically if there is a problem connecting to the local mysql instance.

The configuration section of my cib.xml looks like this…

      <cluster_property_set id="cib-bootstrap-options">
        <nvpair id="cib-bootstrap-options-dc-version" name="dc-version" value="1.0.9-89bd754939df5150de7cd76835f98fe90851b677"/>
        <nvpair id="cib-bootstrap-options-cluster-infrastructure" name="cluster-infrastructure" value="openais"/>
        <nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="false"/>
        <nvpair id="cib-bootstrap-options-expected-quorum-votes" name="expected-quorum-votes" value="2"/>
      <node id="" uname="" type="normal"/>
      <node id="" uname="" type="normal"/>
      <group id="group1">
        <primitive class="ocf" id="ip0" provider="heartbeat" type="IPaddr2">
          <instance_attributes id="ip0-instance_attributes">
            <nvpair id="ip0-instance_attributes-ip" name="ip" value=""/>
            <nvpair id="ip0-instance_attributes-nic" name="nic" value="eth0"/>
            <nvpair id="ip0-instance_attributes-cidr_netmask" name="cidr_netmask" value="22"/>
            <nvpair id="ip0-instance_attributes-broadcast" name="broadcast" value=""/>
      <rsc_order id="ip_before_lvs" score="INFINITY">
        <resource_set action="start" id="ip_before_lvs-0">
          <resource_ref id="ip0"/>

I think that I need to add something like the following to my ip0 primitive…

  <op id="....

But I am not sure exactly what I would need in order to check that mysql was running, and also probably log in to mysql and perform a query with a known output. If those two checks fail then the resource should be migrated.

Any pointers appreciated.


I have the exact same setup with heartbeat…

The problem we face is knowing when to migrate the write ip..

Basically checking via login and select doesnt work, i have seen certain tables being corrupted and the one being checked to be fine.

Right now im listening to the mysql log, which is the only reliable place for catching problems…

(after long consideration, i decided not to do automatic migrating)

Hope this helps 🙂

Source : Link , Question Author : davidsmalley , Answer Author : Arenstar

Leave a Comment