Possible to set the specific order of a resource in a Pacemaker group?
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
Solution 1:
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.