[ClusterLabs] How to block/stop a resource from running twice?

Klaus Wenninger kwenning at redhat.com
Mon Apr 24 04:52:34 EDT 2023


On Fri, Apr 21, 2023 at 12:24 PM fs3000 via Users <users at clusterlabs.org>
wrote:

> Hello all,
>
> I'm configuring a two node cluster. Pacemaker 0.9.169 on Centos 7.
>
> guess this is rather the pcs-version ...


> How can i configure a specific service to run just on one node and avoid
> having it running on more than one node simultaneously. If i start the
> service on the other node, it keeps running, pacemaker does not kill it. I
> have googled and searched the docs, but can't find a solution. This is for
> systemd resources. Any ideas please?
>
> Example:
>
> node1# pcs resource create httpd_service systemd:httpd  op monitor
> interval=10s
> node2# systemctl start httpd
>
> httpd keeps running on both nodes. Ideally, pacemaker should kill a second
> instance of that service.
>

When you start pacemaker on a node it will check which resources are
running there (called 'probe')
and thus if you had multiple instances of a primitive running (without a
clone) pacemaker would
take care of that.
But you are starting the systemd-unit after pacemaker.
The checking for a running resource that isn't expected to be running isn't
done periodically (at
least not per default and I don't know a way to achieve that from the top
of my mind).
Resources that have been started by pacemaker (or found running legitimate
on startup) are of course
monitored using that interval you have given.

Klaus

>
> Thanks in advance for any tips you might have.
> _______________________________________________
> Manage your subscription:
> https://lists.clusterlabs.org/mailman/listinfo/users
>
> ClusterLabs home: https://www.clusterlabs.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clusterlabs.org/pipermail/users/attachments/20230424/90f7a08a/attachment.htm>


More information about the Users mailing list