Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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...

<configuration>
    <crm_config>
      <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"/>
      </cluster_property_set>
    </crm_config>
    <nodes>
      <node id="db0.xxx.xxx" uname="db0.xxx.xxx" type="normal"/>
      <node id="db1.xxx.xxx" uname="db1.xxx.xxx" type="normal"/>
    </nodes>
    <resources>
      <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="192.168.101.139"/>
            <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="192.168.103.255"/>
          </instance_attributes>
        </primitive>
      </group>
    </resources>
    <constraints>
      <rsc_order id="ip_before_lvs" score="INFINITY">
        <resource_set action="start" id="ip_before_lvs-0">
          <resource_ref id="ip0"/>
        </resource_set>
      </rsc_order>
    </constraints>
    <rsc_defaults/>
    <op_defaults/>
  </configuration>

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

<operations>
  <op id="....
</operations>

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
    
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! –  davidsmalley Nov 14 '10 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 '10 at 0:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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