I've do more searching, and found "crm_simulate -sL" tool, it says:
native_color: vip-slave allocation score on node1: 100 native_color: vip-slave allocation score on node2: 50 native_color: vip-slave allocation score on node3: INFINITY seems 'pcs constraint colocation add vip-slave with Slave pgsql-master 100' not effect node3 which is also a slave node. On Tue, May 31, 2016 at 12:32 PM, wd <w...@wdicc.com> wrote: > sorry, I've sent to the wrong mailist, fwd to users@clusterlabs.org > > ---------- Forwarded message ---------- > From: wd <w...@wdicc.com> > Date: Tue, May 31, 2016 at 12:04 PM > Subject: Three node cluster constraint > To: pacema...@oss.clusterlabs.org > > > Hi, > > I've setup a three node PostgreSQL cluster, with 2 virtual ip. > > vip-master (ocf::qunar:qIPaddr2): Started node2 > vip-slave (ocf::qunar:qIPaddr2): Started node3 > Master/Slave Set: pgsql-master [pgsql] > pgsql (ocf::qunar:qpgsql): Master node2 > pgsql (ocf::qunar:qpgsql): Started node1 > pgsql (ocf::qunar:qpgsql): Slave node3 > Masters: [ node2 ] > Slaves: [ node1 node3 ] > > 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: > > Location Constraints: > Ordering Constraints: > promote pgsql-master then start vip-master (score:INFINITY) > (non-symmetrical) > demote pgsql-master then stop vip-master (score:0) (non-symmetrical) > Colocation Constraints: > vip-master with pgsql-master (score:INFINITY) (rsc-role:Started) > (with-rsc-role:Master) > vip-slave with pgsql-master (score:100) (rsc-role:Started) > (with-rsc-role:Slave) > vip-slave with pgsql-master (score:50) (rsc-role:Started) > (with-rsc-role:Master) > > If I kill pgsql on node3: > > vip-master (ocf::qunar:qIPaddr2): Started node2 > vip-slave (ocf::qunar:qIPaddr2): Started node3 > Master/Slave Set: pgsql-master [pgsql] > pgsql (ocf::qunar:qpgsql): Master node2 > pgsql (ocf::qunar:qpgsql): Slave node1 > pgsql (ocf::qunar:qpgsql): Stopped > Masters: [ node2 ] > Slaves: [ node1 ] > Stopped: [ node3 ] > > vip-slave will not goto node1, where am I wrong ? > >
_______________________________________________ Users mailing list: Users@clusterlabs.org http://clusterlabs.org/mailman/listinfo/users Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf Bugs: http://bugs.clusterlabs.org