
我设置了 2 台机器,安装了 Pacemaker 和 Corosync。其中运行着 PostgreSQL 主/从集。主服务器有一个资源组,该资源组有一个虚拟 IP 和两个应该在主服务器上运行的附加服务。如果通过关闭数据库主服务器触发故障转移,这会将组中的所有服务迁移到另一个节点,这正是我期望和想要它做的事情。
但是,当我终止这些附加服务时,它们只会被标记为失败,仅此而已。由于我只希望在数据库发生故障时进行迁移,所以这实际上没问题。但是,我希望 Pacemaker 在这些服务发生故障时重新启动它们,而不仅仅是将它们标记为失败。
我的期望是,当我将 on-fail=restart 标志添加到这些服务的监视操作时,它就会做到这一点,但事实并非如此。
该组如下所示:
Group: master-group
Resource: VirtualIP (class=ocf provider=heartbeat type=IPaddr2)
Attributes: ip=1.2.3.4 cidr_netmask=24 nic=ens1f0
Operations: start interval=0s timeout=20s (VirtualIP-start-interval-0s)
stop interval=0s timeout=20s (VirtualIP-stop-interval-0s)
monitor interval=30s (VirtualIP-monitor-interval-30s)
Resource: additional-resource1 (class=ocf provider=heartbeat type=additional-resource1)
Operations: stop interval=0s timeout=20s (additional-resource1-stop-interval-0s)
monitor interval=60s timeout=20s (additional-resource1-monitor-interval-60s)
start interval=0s on-fail=restart timeout=20s (additional-resource1-start-interval-0s)
Resource: additional-resource2 (class=lsb type=additional-resource2)
Operations: start interval=10s on-fail=restart timeout=60s (additional-resource2-start-interval-10s)
stop interval=0s timeout=20s (additional-resource2-stop-interval-0s)
monitor interval=60s on-fail=restart timeout=0s (additional-resource2-monitor-interval-60s)
Stonith Devices:
Fencing Levels:
Location Constraints:
Ordering Constraints:
promote msPostgresql then start master-group (score:INFINITY) (non-symmetrical) (id:order-msPostgresql-master-group-INFINITY)
demote msPostgresql then stop master-group (score:0) (non-symmetrical) (id:order-msPostgresql-master-group-0)
Colocation Constraints:
master-group with msPostgresql (score:INFINITY) (rsc-role:Started) (with-rsc-role:Master) (id:colocation-master-group-msPostgresql-INFINITY)
Ticket Constraints:
Alerts:
No alerts defined
Resources Defaults:
resource-stickiness: INFINITY
migration-threshold: 1
Operations Defaults:
No defaults set
Cluster Properties:
cluster-infrastructure: corosync
dc-version: 1.1.15-11.el7_3.4-e174ec8
have-watchdog: false
last-lrm-refresh: 1498820659
no-quorum-policy: ignore
stonith-enabled: false
Node Attributes:
node1: pgsql-data-status=LATEST
node2: pgsql-data-status=STREAMING|SYNC
有人能解释一下如何实现这一点吗?