5.6. 为 ASCS 和 ERS 创建限制
为 ASCS 和 ERS 资源组配置共处约束,以避免在正常情况下在同一节点上运行。
添加顺序约束,以确保仅在 ASCS 组完全启动后停止 ERS 资源组。如果 pacemaker 决定在停止 ERS 资源组的同时启动 ASCS 资源组,则必须等待 ASCS 实例完全启动,其中包括从正在运行的 ERS 实例恢复复制的 enqueue 数据。只有 ERS 组可以停止,例如,因为组之间的 colocation 约束的结果。
流程
为 ASCS 和 ERS 资源组创建 colocation 约束。命令中组的顺序很重要:
[root]# pcs constraint colocation add grp_<SID>_ERS<ers_instance> \ with grp_<SID>_ASCS<ascs_instance> -5000-
将
<SID> 替换为您的 ASCS 和 ERS SID,例如S4H。 -
将
<ers_instance> 替换为您的 ERS 实例号,例如29。 -
将
<ascs_instance> 替换为您的 ASCS 实例编号,例如20。
-
将
忽略在后续操作系统版本中更改的信息弃用警告:
弃用警告: Using -5000 without-5000 已弃用,这些参数将被视为未来 pcs 版本中的独立选项。
可选:在使用 ENSA1 时,您必须确保 ASCS 实例在运行 ERS 实例的节点上启动。这需要从 ERS 恢复到 ASCS。为 ASCS 资源创建位置约束规则:
[root]# pcs constraint location grp_<SID>_ASCS<instance> rule score=2000 runs_ers_<SID> eq 1-
将
<SID> 替换为您的 ASCS 和 ERS SID,例如S4H。 将
<instance> 替换为您的 ASCS 实例编号,例如20。run_ers_<SID> 是一个集群节点属性,SAPInstance 资源代理创建。它可用于查找集群中运行 ERS 实例资源的位置。
-
将
为 ASCS 和 ERS 资源组创建顺序约束。这样可确保在 ASCS 完全启动并从 ERS 实例导入 enqueue 数据前不会移动 ERS 实例:
[root]# pcs constraint order start grp_<SID>_ASCS<ascs_instance> \ then stop grp_<SID>_ERS<ers_instance> symmetrical=false kind=Optional-
将
<SID> 替换为您的 ASCS 和 ERS SID,例如S4H。 -
将
<ers_instance> 替换为您的 ERS 实例号,例如29。 -
将
<ascs_instance> 替换为您的 ASCS 实例编号,例如20。
-
将
验证
检查约束是否已正确配置。
使用 ENSA1 时的示例:
[root]# pcs constraint Location Constraints: Resource: grp_S4H_ASCS20 Constraint: location-grp_S4H_ASCS20 Rule: score=2000 Expression: runs_ers_S4H eq 1 Colocation Constraints: resource 'grp_S4H_ERS29' with resource 'grp_S4H_ASCS20' score=-5000 Order Constraints: start resource 'grp_S4H_ASCS20' then stop resource 'grp_S4H_ERS29' symmetrical=0 kind=Optional使用 ENSA2 的示例:
[root]# pcs constraint Colocation Constraints: resource 'grp_S4H_ERS29' with resource 'grp_S4H_ASCS20' score=-5000 Order Constraints: start resource 'grp_S4H_ASCS20' then stop resource 'grp_S4H_ERS29' symmetrical=0 kind=Optional
由于使用 symmetrical=false 和 kind=Optional,因此可能会出现顺序约束无效的情况。如需更多信息,请参阅确定运行集群资源的顺序。