Best way to automate a VRRP failover?

Tom Limoncelli <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <CAHVFxgkg3hL3CoeOmi7qP8R_PO4aikWxJ_J7_bP4n9s3m=vcbQ@mail.gmail.com>
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

-- 
Email: [email protected]    Work: [email protected]
Blog:  http://EverythingSysadmin.com

------------------------------------------------------------------------------
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
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.