Rhys,

HAProxy resolves IPs of backend servers only once during startup. As new
EC2 instances get an new IP on every startup, HAProxy doesn't find your
new instance. Because of that, it is generally discouraged to use
hostnames in backend sepcifications.

You have basically two ways to solve that:

* You can restart HAProxy to force a re-resolution of DNS names
* You can use elastic IPs for your servers which gives them static IPs.

And if I were you, I'd use elastic IPs as dynamic IPs on servers gives
me bad headaches personally...

--Holger

On 2011-10-14 10:57, Rhys Powell wrote:
> Hello all,
> 
> Have a problem at the moment that I just cant seem to fix. We currently
> run a master RDS instance but between the hours of 8am and 6pm we spawn
> a read only replica up so that there is no affect on writes while some
> of the longer queries are made.
> 
> If we restart haproxy it instantly pick up this slave but it never finds
> it with out a restart. ANyone else had this probelm or know what a fix is?
> 
> config file is below
> 
> TIA
> 
> Rhys
> 
> global
>         log 127.0.0.1   local0
>         maxconn 4096
>         user haproxy
>         group haproxy
>         daemon
> 
> defaults
>         log     global
>         mode    tcp
>         option  tcplog
>         option  dontlognull
>         retries 3
>         option redispatch
>         contimeout      5000
>         clitimeout      50000
>         srvtimeout      50000
> 
> listen mysql-pdw
>         bind 0.0.0.0:3306 <http://0.0.0.0:3306>
>         option mysql-check user theusername
>         hash-type consistent
>         balance roundrobin
>         server slave2 nameofslave2andid.rds.amazonaws.com:3306
> <http://nameofslave2andid.rds.amazonaws.com:3306> weight 100 check inter
> 5s observe layer4
>         server slave1 nameofslave1andid.rds.amazonaws.com:3306
> <http://nameofslave1andid.rds.amazonaws.com:3306> weight 10 check inter
> 5s observe layer4
>         server master nameofmasterandid.rds.amazonaws.com:3306
> <http://nameofmasterandid.rds.amazonaws.com:3306> weight 1 check inter
> 5s observe layer4
> 
> 
> 


Reply via email to