[ClusterLabs] Start resource only if another resource is stopped
Miro Igov
miro.igov at pharmya.com
Thu Aug 11 10:34:25 EDT 2022
Hello,
I am trying to create failover resource that would start if another resource
is stopped and stop when the resource is started back.
It is 4 node cluster (with qdevice) where nodes are virtual machines and two
of them are hosted in a datacenter and the other 2 VMs in another
datacenter.
Names of the nodes are:
nas-sync-test1
intranet-test1
nas-sync-test2
intranet-test2
The nodes ending with 1 are hosted in same datacenter and ending in 2 are in
the other datacenter.
nas-sync-test* nodes are running NFS servers and exports:
nfs_server_1, nfs_export_1 (running on nas-sync-test1)
nfs_server_2, nfs_export_2 (running on nas-sync-test2)
intranet-test1 is running NFS mount data_1 (mounting the nfs_export_1),
intranet-test2 is running data_2 (mounting nfs_export_2).
I created data_1_failover which is mounting the nfs_export_1 too and would
like to be running on intranet-test2 ONLY if data_2 is down. So the idea is
it mounts nfs_export_1 on intranet-test2 only when the local mount data_2 is
stopped (note the nfs_server_1 runs on one datacenter and intranet-test2 in
the another DC)
Also created data_2_failover with the same purpose as data_1_failover.
I would like to ask how to set the failover mounts automatically start when
ordinary mounts stop?
Current configuration of the constraints:
tag all_mounts data_1 data_2 data_1_failover data_2_failover
tag sync_1 nfs_server_1 nfs_export_1
tag sync_2 nfs_server_2 nfs_export_2
location deny_data_1 data_1 -inf: intranet-test2
location deny_data_2 data_2 -inf: intranet-test1
location deny_failover_1 data_1_failover -inf: intranet-test1
location deny_failover_2 data_2_failover -inf: intranet-test2
location deny_sync_1 sync_1 \
rule -inf: #uname ne nas-sync-test1
location deny_sync_2 sync_2 \
rule -inf: #uname ne nas-sync-test2
location mount_on_intranet all_mounts \
rule -inf: #uname eq nas-sync-test1 or #uname eq nas-sync-test2
colocation nfs_1 inf: nfs_export_1 nfs_server_1
colocation nfs_2 inf: nfs_export_2 nfs_server_2
order nfs_server_export_1 Mandatory: nfs_server_1 nfs_export_1
order nfs_server_export_2 Mandatory: nfs_server_2 nfs_export_2
order mount_1 Mandatory: nfs_export_1 data_1
order mount_1_failover Mandatory: nfs_export_1 data_1_failover
order mount_2 Mandatory: nfs_export_2 data_2
order mount_2_failover Mandatory: nfs_export_2 data_2_failover
I tried adding following colocation:
colocation failover_1 -inf: data_2_failover data_1
and it is stopping data_2_failover when data_1 is started, also it starts
data_2_failover when data_1 is stopped - exactly as needed!
Full List of Resources:
* admin-ip (ocf::heartbeat:IPaddr2): Started intranet-test2
* stonith-sbd (stonith:external/sbd): Started intranet-test1
* nfs_export_1 (ocf::heartbeat:exportfs): Started
nas-sync-test1
* nfs_server_1 (systemd:nfs-server): Started nas-sync-test1
* nfs_export_2 (ocf::heartbeat:exportfs): Started
nas-sync-test2
* nfs_server_2 (systemd:nfs-server): Started nas-sync-test2
* data_1_failover (ocf::heartbeat:Filesystem): Started
intranet-test2
* data_2_failover (ocf::heartbeat:Filesystem): Stopped
* data_2 (ocf::heartbeat:Filesystem): Started intranet-test2
* data_1 (ocf::heartbeat:Filesystem): Started intranet-test1
Full List of Resources:
* admin-ip (ocf::heartbeat:IPaddr2): Started intranet-test2
* stonith-sbd (stonith:external/sbd): Started intranet-test1
* nfs_export_1 (ocf::heartbeat:exportfs): Started
nas-sync-test1
* nfs_server_1 (systemd:nfs-server): Started nas-sync-test1
* nfs_export_2 (ocf::heartbeat:exportfs): Started
nas-sync-test2
* nfs_server_2 (systemd:nfs-server): Started nas-sync-test2
* data_1_failover (ocf::heartbeat:Filesystem): Started
intranet-test2
* data_2_failover (ocf::heartbeat:Filesystem): Started
intranet-test1
* data_2 (ocf::heartbeat:Filesystem): Started intranet-test2
* data_1 (ocf::heartbeat:Filesystem): Stopped (disabled)
But it does not start data_2_failover when nfs_export_1 is stopped which
stops data_1:
Full List of Resources:
* admin-ip (ocf::heartbeat:IPaddr2): Started intranet-test2
* stonith-sbd (stonith:external/sbd): Started intranet-test1
* nfs_export_1 (ocf::heartbeat:exportfs): Stopped (disabled)
* nfs_server_1 (systemd:nfs-server): Started nas-sync-test1
* nfs_export_2 (ocf::heartbeat:exportfs): Started
nas-sync-test2
* nfs_server_2 (systemd:nfs-server): Started nas-sync-test2
* data_1_failover (ocf::heartbeat:Filesystem): Stopped
* data_2_failover (ocf::heartbeat:Filesystem): Stopped
* data_2 (ocf::heartbeat:Filesystem): Started intranet-test2
* data_1 (ocf::heartbeat:Filesystem): Stopped
Any help and ideas will be appreciated.
--
This message has been sent as a part of discussion between PHARMYA and the
addressee whose name is specified above. Should you receive this message by
mistake, we would be most grateful if you informed us that the message has
been sent to you. In this case, we also ask that you delete this message
from your mailbox, and do not forward it or any part of it to anyone else.
Thank you for your cooperation and understanding.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/users/attachments/20220811/5861e488/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PharmyaGDPRLogo1.png
Type: image/png
Size: 848 bytes
Desc: not available
URL: <https://lists.clusterlabs.org/pipermail/users/attachments/20220811/5861e488/attachment.png>
More information about the Users
mailing list