[ClusterLabs] Mutually exclusive resources ?

Ken Gaillot kgaillot at redhat.com
Wed Sep 27 10:58:21 EDT 2023


On Wed, 2023-09-27 at 16:24 +0200, Adam Cecile wrote:
> On 9/27/23 16:02, Ken Gaillot wrote:
> > On Wed, 2023-09-27 at 15:42 +0300, Andrei Borzenkov wrote:
> > > On Wed, Sep 27, 2023 at 3:21 PM Adam Cecile <acecile at le-vert.net>
> > > wrote:
> > > > Hello,
> > > > 
> > > > 
> > > > I'm struggling to understand if it's possible to create some
> > > > kind
> > > > of constraint to avoid two different resources to be running on
> > > > the
> > > > same host.
> > > > 
> > > > Basically, I'd like to have floating IP "1" and floating IP "2"
> > > > always being assigned to DIFFERENT nodes.
> > > > 
> > > > Is that something possible ?
> > > 
> > > Sure, negative colocation constraint.
> > > 
> > > > Can you give me a hint ?
> > > > 
> > > 
> > > Using crmsh:
> > > 
> > > colcoation IP1-no-with-IP2 -inf: IP1 IP2
> > > 
> > > > Thanks in advance, Adam.
> > 
> > To elaborate, use -INFINITY if you want the IPs to *never* run on
> > the
> > same node, even if there are no other nodes available (meaning one
> > of
> > them has to stop). If you *prefer* that they run on different
> > nodes,
> > but want to allow them to run on the same node in a degraded
> > cluster,
> > use a finite negative score.
> 
> That's exactly what I tried to do:
> crm configure primitive Freeradius systemd:freeradius.service op
> start interval=0 timeout=120 op stop interval=0 timeout=120 op
> monitor interval=60 timeout=100
> crm configure clone Clone-Freeradius Freeradius
> 
> crm configure primitive Shared-IPv4-Cisco-ISE-1 IPaddr2 params
> ip=10.1.1.1 nic=eth0 cidr_netmask=24 meta migration-threshold=2 op
> monitor interval=60 timeout=30 resource-stickiness=50
> crm configure primitive Shared-IPv4-Cisco-ISE-2 IPaddr2 params
> ip=10.1.1.2 nic=eth0 cidr_netmask=24 meta migration-threshold=2 op
> monitor interval=60 timeout=30 resource-stickiness=50
> 
> crm configure location Shared-IPv4-Cisco-ISE-1-Prefer-BRT Shared-
> IPv4-Cisco-ISE-1 50: infra-brt
> crm configure location Shared-IPv4-Cisco-ISE-2-Prefer-BTZ Shared-
> IPv4-Cisco-ISE-2 50: infra-btz
> crm configure colocation Shared-IPv4-Cisco-ISE-Different-Nodes -100:
> Shared-IPv4-Cisco-ISE-1 Shared-IPv4-Cisco-ISE-2
> My hope is that IP1 stays in infra-brt and IP2 goes on infra-btz. I
> want to allow them to keep running on different host so I also added
> stickiness. However, I really do not want them to both run on same
> node so I added a colocation with negative higher score.
> Does it looks good to you ?

Yep, that should work.

The way you have it, if there's some sort of problem and both IPs end
up on the same node, the IP that doesn't prefer that node will move
back to its preferred node once the problem is resolved. That sounds
like what you want, but if you'd rather it not move, you could raise
stickiness above 100.
-- 
Ken Gaillot <kgaillot at redhat.com>



More information about the Users mailing list