[Pacemaker] OCF Resource agent promote question

Steven Bambling smbambling at arin.net
Mon Mar 25 17:44:54 UTC 2013


All,

I'm trying to work on a OCF resource agent that uses postgresql streaming replication.  I'm running into a few issues that I hope might be answered or at least some pointers given to steer me in the right direction.

1.  A quick way of obtaining a list of "Online" nodes in the cluster that a resource will be able to migrate to.  I've accomplished it with some grep and see but its not pretty or fast.

# time pcs status | grep Online | sed -e "s/.*\[\(.*\)\]/\1/" | sed 's/ //'
p1.example.net p2.example.net

real	0m2.797s
user	0m0.084s
sys	0m0.024s

Once I get a list of active/online nodes in the cluster my thinking was to use PSQL to get the current xlog location and lag or each of the remaining nodes and compare them.  If the node has a greater log position and/or less lag it will be given a greater master preference.  

2.  How to force a monitor/probe before a promote is run on ALL nodes to make sure that the master preference is up to date before migrating/failing over the resource.
	- I was thinking that maybe during the promote call it could get the log location and lag from each of the nodes via an psql call ( like above) and then force the resource to a specific node.  Is there a way to do this and does it sound like a sane idea ?


The start of my RA is located here suggestions and comments 100% welcome https://github.com/smbambling/pgsqlsr/blob/master/pgsqlsr

v/r

STEVE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20130325/e411474c/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.clusterlabs.org/pipermail/pacemaker/attachments/20130325/e411474c/attachment-0003.sig>


More information about the Pacemaker mailing list