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

2023-04-26 Thread Ken Gaillot
On Wed, 2023-04-26 at 17:05 +, fs3000 via Users wrote:
> --- Original Message ---
> On Monday, April 24th, 2023 at 10:08, Andrei Borzenkov <
> arvidj...@gmail.com> wrote:
> 
> 
> > On Mon, Apr 24, 2023 at 11:52 AM Klaus Wenninger 
> > kwenn...@redhat.com wrote:
> > 
> > > 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).
> > 
> > op monitor role=Stopped interval=20s
> 
> Thanks a lot for the tip. It works, Not perfect, but that's fine.
> When it detects the service is also active on a second node, it stops
> the service on all nodes, and restarts the service on the first node.
> Would be better if only it stopped the service on the second none,
> leaving the service on the first node untouched. I understand this is
> due to the multiple-active setting however:
> 
> 
> What should the cluster do if it ever finds the resource active on
> more than one node? Allowed values: 
> 
> - block: mark the resource as unmanaged
> - stop_only: stop all active instances and leave them that way
> - stop_start: stop all active instances and start the resource in one
> location only
> 
> DEFAULT: stop_start
> 
> 
> From: 
> https://clusterlabs.org/pacemaker/doc/deprecated/en-US/Pacemaker/1.1/html/Pacemaker_Explained/s-resource-options.html

Since Pacemaker 2.1.4, multiple-active can be set to "stop_unexpected"
to do what you want.

It's not the default because some services may no longer operate
correctly if an extra instance was started on the same host, so it's on
the admin to be confident their services can handle it.
-- 
Ken Gaillot 

___
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/


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

2023-04-26 Thread fs3000 via Users
--- Original Message ---
On Monday, April 24th, 2023 at 10:08, Andrei Borzenkov  
wrote:


> On Mon, Apr 24, 2023 at 11:52 AM Klaus Wenninger kwenn...@redhat.com wrote:
> 
> > 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).
> 
> 
> op monitor role=Stopped interval=20s


Thanks a lot for the tip. It works, Not perfect, but that's fine. When it 
detects the service is also active on a second node, it stops the service on 
all nodes, and restarts the service on the first node. Would be better if only 
it stopped the service on the second none, leaving the service on the first 
node untouched. I understand this is due to the multiple-active setting however:


What should the cluster do if it ever finds the resource active on more than 
one node? Allowed values: 

- block: mark the resource as unmanaged
- stop_only: stop all active instances and leave them that way
- stop_start: stop all active instances and start the resource in one location 
only

DEFAULT: stop_start


From: 
https://clusterlabs.org/pacemaker/doc/deprecated/en-US/Pacemaker/1.1/html/Pacemaker_Explained/s-resource-options.html
___
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/


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

2023-04-24 Thread Andrei Borzenkov
On Mon, Apr 24, 2023 at 11:52 AM Klaus Wenninger  wrote:
> 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).

op monitor role=Stopped interval=20s
___
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/


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

2023-04-24 Thread Klaus Wenninger
On Fri, Apr 21, 2023 at 12:24 PM fs3000 via Users 
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/
>
___
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

ClusterLabs home: https://www.clusterlabs.org/