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="db0.xxx.xxx" uname="db0.xxx.xxx" type="normal"/>
      <node id="db1.xxx.xxx" uname="db1.xxx.xxx" 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.

1 Answer 1


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 :)

  • I wanted to move the IP if mysql dies really, not after any kind of table corruption etc. I do trust it to do that automatically. Any idea how I even go about configuring it to move a shared IP in response to mysql not running, at the moment pacemaker is trying to start and stop mysql for me which I definitely don't want to happen! Nov 14, 2010 at 21:06
  • I never use pacemaker/heartbeat to manage resources other than IP addresses.. i dont like the idea of a cluster managing init scripts.. A cluster in my opinion should all be running not pieces starting and stopping ( basically the ip is the glue that holds it together )... Use an ip address which moves between nodes (preferably 2 mysql only).. Using replication on the servers in master/master with interleaved keys ( or dont use auto-increment ).... Basically configure a "mysql write" IP which moves to your write masters.. And handle Mysql failure on a different level
    – Arenstar
    Nov 15, 2010 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.