Pacemaker:禁止停止节点上的资源

Pacemaker:禁止停止节点上的资源

我有一个从属 IP 资源,我想在 2 节点 PostgreSQL 群集中的正常运行下将其定位在我的从属服务器上以用于只读目的。

一切都很好,直到从属节点上的 pgsql 服务出现故障;slave-ip 资源仍然分配给我的从属节点:

 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

我的限制如下:

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)

我尝试了这个,但是没有用:

pcs constraint colocation add slave-ip with stopped pgsql-master score=-INFINITY

相关内容