<div dir="ltr">I've do more searching, and found "crm_simulate -sL" tool, it says:<div><br></div><div><div>native_color: vip-slave allocation score on node1: 100</div><div>native_color: vip-slave allocation score on node2: 50</div><div>native_color: vip-slave allocation score on node3: INFINITY</div></div><div><br></div><div>seems 'pcs constraint colocation add vip-slave with Slave pgsql-master 100' not effect node3 which is also a slave node.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 31, 2016 at 12:32 PM, wd <span dir="ltr"><<a href="mailto:wd@wdicc.com" target="_blank">wd@wdicc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">sorry, I've sent to the wrong mailist, fwd to <span style="color:rgb(119,119,119);font-family:'normal arial',sans-serif;font-size:12px">users</span><span style="color:rgb(119,119,119);font-family:'normal arial',sans-serif;font-size:12px">@<a href="http://clusterlabs.org" target="_blank">clusterlabs.org</a></span><div><div class="h5"><div><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">wd</b> <span dir="ltr"><<a href="mailto:wd@wdicc.com" target="_blank">wd@wdicc.com</a>></span><br>Date: Tue, May 31, 2016 at 12:04 PM<br>Subject: Three node cluster constraint<br>To: <a href="mailto:pacemaker@oss.clusterlabs.org" target="_blank">pacemaker@oss.clusterlabs.org</a><br><br><br><div dir="ltr">Hi,<div><br></div><div>I've setup a three node PostgreSQL cluster, with 2 virtual ip.</div><div><br></div><div><div>vip-master (ocf::qunar:qIPaddr2): Started node2</div><div>vip-slave (ocf::qunar:qIPaddr2): Started node3</div><div> Master/Slave Set: pgsql-master [pgsql]</div><div> pgsql (ocf::qunar:qpgsql): Master node2</div><div> pgsql (ocf::qunar:qpgsql): Started node1</div><div> pgsql (ocf::qunar:qpgsql): Slave node3</div><div> Masters: [ node2 ]</div><div> Slaves: [ node1 node3 ]</div></div><div><br></div><div>I want vip-slave is running on slave node if there is any slave node running. And if there is no slave node running, vip-slave should run at master node. I've tried these constraint:</div><div><br></div><div><div>Location Constraints:</div><div>Ordering Constraints:</div><div> promote pgsql-master then start vip-master (score:INFINITY) (non-symmetrical)</div><div> demote pgsql-master then stop vip-master (score:0) (non-symmetrical)</div><div>Colocation Constraints:</div><div> vip-master with pgsql-master (score:INFINITY) (rsc-role:Started) (with-rsc-role:Master)</div><div> vip-slave with pgsql-master (score:100) (rsc-role:Started) (with-rsc-role:Slave)</div><div> vip-slave with pgsql-master (score:50) (rsc-role:Started) (with-rsc-role:Master)</div></div><div><br></div><div>If I kill pgsql on node3:</div><div><br></div><div><div>vip-master (ocf::qunar:qIPaddr2): Started node2</div><div>vip-slave (ocf::qunar:qIPaddr2): Started node3</div><div> Master/Slave Set: pgsql-master [pgsql]</div><div> pgsql (ocf::qunar:qpgsql): Master node2</div><div> pgsql (ocf::qunar:qpgsql): Slave node1</div><div> pgsql (ocf::qunar:qpgsql): Stopped</div><div> Masters: [ node2 ]</div><div> Slaves: [ node1 ]</div><div> Stopped: [ node3 ]</div></div><div><br></div><div>vip-slave will not goto node1, where am I wrong ?</div></div>
</div><br></div></div></div></div>
</blockquote></div><br></div>