The new Amazon Opsworks service uses haproxy rather than Amazon's own very limited elastic load-balancer so I started investigating haproxy as a better option for load-balancing our web app servers, providing session fail-over, etc. I got haproxy working without a hitch with one haproxy server and several web app servers but I'd like to avoid SPOF.
My question is, do I need to setup a second NIC on each haproxy server possibly with the same internal IP address 10.0.0.x? Since assigning an external address (elastic IP) and forwarding traffic to the internal IP is done by Amazon i'm not sure how to configure this.
I think I figured it out and I'm testing now – you use the internal IP of the main server for keepalived on both servers.
Best Answer
I use haproxy too for our load balancing because at the time of design, Amazon's Elastic Load Balancing (ELB) did not support servers within a VPC. They have that feature now (I believe, have not used it since haproxy is working great for us).
We didn't try keepalived at all for two reasons:
Therefore, the solution we implemented was:
One potential risk is that in time of major AWS outages, we sometimes noticed AWS console and API will start to fail (completely or more frequently than normal). This may impact attempts to remap the elastic IP.