<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">All,<div><br></div><div>I'm trying to work on a OCF resource agent that uses postgresql streaming replication. &nbsp;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.</div><div><br></div><div>1. &nbsp;A quick way of obtaining a list of "Online" nodes in the cluster that a resource will be able to migrate to. &nbsp;I've accomplished it with some grep and see but its not pretty or fast.</div><div><br></div><div><div># time pcs status | grep Online | sed -e "s/.*\[\(.*\)\]/\1/" | sed 's/ //'</div><div><a href="http://p1.example.net">p1.example.net</a> <a href="http://p2.example.net">p2.example.net</a></div><div><br></div><div>real<span class="Apple-tab-span" style="white-space:pre">        </span>0m2.797s</div><div>user<span class="Apple-tab-span" style="white-space:pre">        </span>0m0.084s</div><div>sys<span class="Apple-tab-span" style="white-space:pre">        </span>0m0.024s</div></div><div><br></div><div>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. &nbsp;If the node has a greater log position and/or less lag it will be given a greater master preference. &nbsp;</div><div><br></div><div>2. &nbsp;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.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>- 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. &nbsp;Is there a way to do this and does it sound like a sane idea ?</div><div><br></div><div><br></div><div>The start of my RA is located here suggestions and comments 100% welcome&nbsp;<a href="https://github.com/smbambling/pgsqlsr/blob/master/pgsqlsr">https://github.com/smbambling/pgsqlsr/blob/master/pgsqlsr</a></div><div><br></div><div>v/r</div><div><br></div><div>STEVE</div></body></html>