[ale] DB Failover Load Balancer

Lightner, Jeff JLightner at dsservices.com
Mon Jul 20 16:34:11 EDT 2015


We did something similar to what Leam describes for our Postgres failover.

I wrote init scripts to insure the virtual IP comes up on first server booted (if not already up on the other server).   Also wrote a script to be used by DBAs (as sudo) that allows them to do the virtual IP move from one server to the other (or vice-versa) on demand.    We don’t start Postgres automatically on either server.

In our DNS we have a virtual host name associated with the IP we move and applications all use this virtual host name rather than the physical host name of either of the Postgres servers.


From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of leam hall
Sent: Monday, July 20, 2015 3:50 PM
To: Atlanta Linux Enthusiasts
Subject: Re: [ale] DB Failover Load Balancer

On Mon, Jul 20, 2015 at 3:32 PM, Robert L. Harris <robert.l.harris at gmail.com<mailto:robert.l.harris at gmail.com>> wrote:
Guys,
  I'm setting up an HAProxy to balance between some web servers.  Working great with a least-used mode.

  The next step is to balance between 2 databases but I don't want them in a  round robin or even 'normal' balancing.  The DBA's are setting up one-way data replication only ( long argument they are refusing to explain ).  So I need to have 2 hosts in a 'cluster' with HostA as the single/primary and if it goes down, fail over to HostB.  If HostA comes back up, do NOT fail back to HostA until manually told to do so ( data re-sync, etc ).

Any thoughts?  I don't see an option to configure HAproxy in this type of config.

Robert

I did something like this a few years ago; basically use a Virtual IP and have something/someone do a failover of the VIP. In our case it was the Service Desk, but you could script it as well. Just have the primary node not assume the VIP if it reboots. Some DB HA setups use private interconnects so you could have them test for the other DB, etc.
This is not the absolute fastest failover, but it does work.
Leam

--
Mind on a Mission<http://leamhall.blogspot.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20150720/eef81bc3/attachment.html>


More information about the Ale mailing list