Re: Best way to automate a VRRP failover?

Quentin Armitage <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Organization The Armitage family
Message-ID <[email protected]>
On Mon, 2016-05-23 at 09:57 -0400, Tom Limoncelli wrote:

> Hi!
> 
> I'm writing a program to force a pair of keepalived routers to fail
> over..  My current algorithm is:
> 
> Normally our keepalived hosts run as:
>     InstancePreempt = NoPreempt
>     BasePriority = 100 or 101 (for host A and B)
> 
> Force a failover:
>     Suppose A is the master and B is the backup.
>     If we want to turn B into the master, we send SNMP commands to B:
>       set InstanceBasePriority = X
>       (where X is a value greater than BasePriority or
> EffectivePriority of either A or B)
>       set InstancePreempt = Preempt
>       Wait for host B's InstanceState to change to Master.
>       set InstancePreempt = NoPreempt
>       set InstanceBasePriority = Y (where Y is 100 or 101)
> 
> These seems to work but it seems wonky. Is there a better or more
> recommended way?
> 
> In particular, does it make sense to run with NoPreempt normally but
> change it just when I want to force a failover?
> How does BasePriority and EffectivePriority work?
> 
> Thanks!
> Tom
> 

Setting preempt or nopreempt is entirely a matter for what you want to
achieve overall. If you want the lower priority router to remain master
even when the higher priority router comes back up, then you need
nopreempt; if you want the higher priority router to take over when it
comes back up, set preempt (or don't specify anything).

EffectivePriority is based on BasePriority but is updated by the
track_interface settings on vrrp_instances and the results of executing
the scripts specified in the vrrp_script blocks, according to their
weights, so either increased or decreased depending on whether the
weights are positive or negative. This means that the priority of a
router can be dynamic, depending on what interfaces are up/down, and on
the success of the scripts when executed.

I hope that helps,
Quentin

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j

_______________________________________________
Keepalived-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/keepalived-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.