how to configure 2 droplets with HAProxy + keepalived

May 7, 2015 4.6k views
Load Balancing

About that response by a DO member team:

“If your load balancer went down in the environment described in this article (1 droplet as HAproxy + 2 droplets as webservers), your site would become unavailable. The easiest way to avoid having the load balancer be a single point of failure is to set up active/passive HAProxy pair. This would require two HAProxy servers and a virtual IP that can float between the two servers. The active HAProxy server would handle all of the requests unless it went down, at which point the passive HAProxy server would take over the requests.”

Can I have a virtual IP that can float between the two servers with Digital Ocean?
How can I configure this?

I have two droplets with active/passive HAProxy pair + keepalived, but I don’t know how to set up the Virtual IP.


1 Answer

DigitalOcean’s current solution for this is the Floating IP. Using the API you can programmatically move the IP address back and forth between multiple Droplets. With keepalived, you can create a highly available setup where one Droplet will “take” the IP address if the other goes down. For a tutorial that walks you through setting this up, check out:

by Melissa Anderson
A DigitalOcean Floating IP is a publicly-accessible static IP address that can be mapped to one of your Droplets. A Floating IP can also be instantly remapped, via the DigitalOcean Control Panel or API, to one of your other Droplets in the same datacenter. This instant remapping capability grants you the ability to design and create High Availability (HA) server infrastructures by adding redundancy to the entry point, or gateway, to your servers.
Have another answer? Share your knowledge.