[ale] DB Failover Load Balancer

James Sumners james.sumners at gmail.com
Mon Jul 20 16:18:02 EDT 2015


Use `backup` in conjunction with a status check[1] to a service you have
written. This service should return "nope, A is no good" until you manually
say otherwise somehow.

A status service can be as simple as portmap executed script like:

```
#!/bin/bash

# This script is to be used by HAProxy's httpchk option, not the
agent-check option

# Do some stuff here to check for availability
myAvailabilityScript

if [ $? -eq 0 ]; then
  echo -e "HTTP/1.1 200 OK\r\n"
  echo -e "Content-type: text/plain\r\n"
  echo -e "\r\n"
  echo -e "Good to go!\r\n"
  echo -e "\r\n"
else
  echo -e "HTTP/1.1 503 Service Unavailable\r\n"
  echo -e "Content-type: text/plain\r\n"
  echo -e "\r\n"
  echo -e "Much sadness\r\n"
  echo -e "\r\n"
fi
```

[1] --
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#5.2-check

On Mon, Jul 20, 2015 at 4:13 PM, James Sumners <james.sumners at gmail.com>
wrote:

> Er, ignore my last one. The setting you want is `backup` --
> http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#5.2-backup
>
> On Mon, Jul 20, 2015 at 3:32 PM, Robert L. Harris <
> 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
>>
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>>
>
>
> --
> James Sumners
> http://james.sumners.info/ (technical profile)
> http://jrfom.com/ (personal site)
> http://haplo.bandcamp.com/ (band page)
>



-- 
James Sumners
http://james.sumners.info/ (technical profile)
http://jrfom.com/ (personal site)
http://haplo.bandcamp.com/ (band page)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20150720/767bb6b3/attachment.html>


More information about the Ale mailing list