I have a slave-ip resource which I'd like to locate on my slave under normal operation in a 2 node PostgreSQL cluster for read-only purposes.
All is fine, right till the point of failure of the pgsql service on the slave node; the slave-ip resource is remains assigned to my slave:
Master/Slave Set: pgsql-master [pgsql]
Masters: [ pgsql01-test.internal.helloworld ]
Stopped: [ pgsql02-test.internal.helloworld ]
master-ip (ocf::heartbeat:IPaddr2): Started pgsql01-test.internal.helloworld
slave-ip (ocf::heartbeat:IPaddr2): Started pgsql02-test.internal.helloworld
My constraints are as follows:
pcs constraint colocation add master-ip with master pgsql-master
pcs constraint colocation add slave-ip with slave pgsql-master score=0
[root@pgsql01-test run]# pcs constraint
Location Constraints:
Resource: master-ip
Enabled on: pgsql01-test.internal.helloworld (score:0)
Enabled on: pgsql02-test.internal.helloworld (score:0)
Ordering Constraints:
start master-ip then promote pgsql-master (kind:Mandatory)
Colocation Constraints:
master-ip with pgsql-master (score:INFINITY) (rsc-role:Started) (with-rsc-role:Master)
slave-ip with pgsql-master (score:0) (rsc-role:Started) (with-rsc-role:Slave)
I tried this, but it doesn't work:
pcs constraint colocation add slave-ip with stopped pgsql-master score=-INFINITY