On 2020-11-30 23:21, Petr Bena wrote:
Hello,

Is there a way to setup a preferred node for a service? I know how to
create constrain that will make it possible to run a service ONLY on
certain node, or constrain that will make it impossible to run 2
services on same node, but I don't want any of that, as in
catastrophical scenarios when services would have to be located together
on same node, this would instead disable it.

Essentially what I want is for service to be always started on preferred node when it is possible, but if it's not possible (eg. node is down) it
would freely run on any other node, with no restrictions and when node
is back up, it would migrate back.

How can I do that?

I do precisely this for an active/passive NFS/ZFS storage appliance pair. One of the VSA has more memory and is less used, so I have it set to prefer
that host.

https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/1.1/html/Clusters_from_Scratch/_prefer_one_node_over_another.html

I believe I used the value infinity, so it will prefer the 2nd host over the 1st if at all possible. My 'pcs constraint':

[root@centos-vsa2 ~]# pcs constraint
Location Constraints:
  Resource: group-zfs
    Enabled on: centos-vsa2 (score:INFINITY)
Ordering Constraints:
Colocation Constraints:
Ticket Constraints:
_______________________________________________
Manage your subscription:
https://lists.clusterlabs.org/mailman/listinfo/users

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

Reply via email to