I am working on a pacemaker project for our master and slave databases to perform IP based failover. There will be two IP resources, one for the master, and one for the slave that have to move together. I realize that what I have marked below is not a complete solution, but the requirements are as follows:
- ip_dbmaster can only run on db1 or db21
- ip_dbslave can only run on dbslave1 or dbslave2
- when ip_dbmaster is on db1, ip_dbslave must be on dbslave1. When ip_dbmaster is on db2, ip_dbslave must be on dbslave2
- before ip_dbmaster and ip_dbslave are run, do some "stuff" (shell scripty stuff, some extended health checks). Only migrate if "stuff" is successful
- same as above, except after the resource migrates
Here is my base configuration:
node $id="75463ec2-702c-427b-965b-b7ffb7814008" db1 node $id="a1f2d612-2d9f-4872-bf24-024f5bece3ce" dbslave2 node $id="d1d42f67-e4f2-4c71-950f-07d94ac01f8d" dbslave1 node $id="f243d865-c1a1-4d52-9100-b0d36a08207c" db2 primitive ip_dbmaster ocf:heartbeat:IPaddr2 \ params ip="10.153.114.100" cidr_netmask="24" primitive ip_dbslave ocf:heartbeat:IPaddr2 \ params ip="10.153.114.101" cidr_netmask="24" location loc-ip-dbmaster-1 ip_dbmaster \ rule $id="loc-ip-dbmaster-1-rule" 200: #uname eq db1 location loc-ip-dbmaster-2 ip_dbmaster \ rule $id="loc-ip-dbmaster-2-rule" 0: #uname eq db2 location loc-ip-dbmaster-3 ip_dbmaster \ rule $id="loc-ip-dbmaster-3-rule" -inf: #uname eq dbslave2 location loc-ip-dbmaster-4 ip_dbmaster \ rule $id="loc-ip-dbmaster-4-rule" -inf: #uname eq dbslave1 location loc-ip-dbslave-1 ip_dbslave \ rule $id="loc-ip-dbslave-1-rule" 200: #uname eq dbslave1 location loc-ip-dbslave-2 ip_dbslave \ rule $id="loc-ip-dbslave-2-rule" 0: #uname eq dbslave2 location loc-ip-dbslave-3 ip_dbslave \ rule $id="loc-ip-dbslave-3-rule" -inf: #uname eq db1 location loc-ip-dbslave-4 ip_dbslave \ rule $id="loc-ip-dbslave-4-rule" -inf: #uname eq db2 property $id="cib-bootstrap-options" \ dc-version="1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd" \ cluster-infrastructure="Heartbeat" \ expected-quorum-votes="2" \ stonith-enabled="false" \ symmetric-cluster="false"
So far, #1 and #2 work just great. #3 seems like it's sort of similar to colocation, but I can't figure out where to start or how to set the dependency. I see a rules engine, but I haven't quite figured it out yet. For 4-5, I have no idea if this can be done via pacemaker at all or whether I have to write an external script to handle this piece.
My goal would be able to do this:
crm resource move ip_dbmaster db1
and have everything just go. I'll settle for
...if I have to code some of this external to Pacemaker, or whether this can be built-in.
Thanks for all your help!