大网数据广告活动
服务器运维问答

Possible to set the specific order of a resource in a Pacemaker group?

· 52CE 我爱测

Given the Pacemaker/Corosync resource configuration described below, is it possible to add a resource in a specific position within the resource group? The configuration is CentOS 7.2 using the RHEL-supplied clustering add-ons. T…

问题原文

原帖链接 · ewwhite · CC BY-SA 3.0

Given the Pacemaker/Corosync resource configuration described below, is it possible to add a resource in a specific position within the resource group? The configuration is CentOS 7.2 using the RHEL-supplied clustering add-ons.

This is a NFS server cluster, and Pacemaker handles the NFS daemon, volumes, exports, virtual-IP and NFS client notification.

When I want to add an NFS mount (exportfs resource) to the cluster setup, it ends up listed after the nfs-notify resource. This breaks the cluster in ugly ways.

I've found the rudimentary pcs resource order commands, which seem to allow specifying resource X needs to run before resource Y, but that's not scalable.

Is this possible?

[root@zfs1-node1 ~]# pcs status
Cluster name: zfs1
Last updated: Tue Jan  5 04:09:11 2016      Last change: Tue Jan  5 04:08:15 2016 by root via cibadmin on zfs1-node1
Stack: corosync
Current DC: zfs1-node1 (version 1.1.13-10.el7-44eb2dd) - partition with quorum
2 nodes and 9 resources configured

Online: [ zfs1-node1 zfs1-node2 ]

Full list of resources:

 fence-vol1 (stonith:fence_scsi):   Started zfs1-node1
 Resource Group: group-vol1
     vol1   (ocf::heartbeat:ZFS):   Started zfs1-node1
     nfs-daemon (ocf::heartbeat:nfsserver): Started zfs1-node1
     nfsinfo    (ocf::heartbeat:exportfs):  Started zfs1-node1
     vol1-management    (ocf::heartbeat:exportfs):  Started zfs1-node1
     vol1-ppro-mirrors  (ocf::heartbeat:exportfs):  Started zfs1-node1
     vol1-staging   (ocf::heartbeat:exportfs):  Started zfs1-node1
     ip-vol1    (ocf::heartbeat:IPaddr2):   Started zfs1-node1
     nfs-notify (ocf::heartbeat:nfsnotify): Started zfs1-node1

PCSD Status:
  zfs1-node1: Online
  zfs1-node2: Online

Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

已采纳解答

原帖链接 · Matt Kereczman · CC BY-SA 3.0

You can use the cibadmin utility to query the Pacemaker configuration, move the primitives around accordingly within the <group id="group-vol1"></group> tags, and then push the new config back into Pacemaker.

The process would look something like this:

# cibadmin --query > /tmp/cib.xml
# vi /tmp/cib.xml
# cibadmin --replace --xml-file /tmp/cib.xml

When you edit cib.xml in vi, you will see your group defined by tags like this:
<group id="group-vol1"> *primitives within the group will go here* </group>

All the primitives will be defined inside of the group tags. They will look like this (ZFS primitive for example:
<primitive id="vol1" class="ocf" provider="heartbeat" type="ZFS"> *attributes and operations will go here* </primitive>

Move the primitives around as you'd like them to be ordered; top first, bottom last. Push the changes into Pacemaker, and you should be good.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。