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.