How to setup High Availability Wordpress i.e implementing a Failover on Digital Ocean

May 29, 2015 2.7k views
Load Balancing Clustering WordPress LAMP Stack MySQL DNS Scaling DigitalOcean Ubuntu

I am running Ubuntu 14.04 and I want to implement a simple yet effective Failover for my Wordpress site, to enable High Availability.

Currently, I am running my Wordpres site on just 1 Droplet. I was thinking about cloning the current Droplet and setup MySQL Master-Master replication in combination with DNS failover from DNSMadeEasy. However, the failover time is too long. It takes up to 10 minutes before the failover takes effect due to the nature DNS works with TTLs and such.

Hence, I started looking for another solution and found this:
However, DigitalOcean does not offer Load Balancers, so I am looking for alternatives.....

My requirements are as pretty simple: In case the main/master Droplet goes down, it should switch over to the Backup/Failover Droplet. That's all. No load balancing required, just failover only. Ofcourse, this requires that the databases on both Droplets are continously synced, else a failover makes no sense. Also, As soon the main/master Droplet comes back online, it should automatically sync the database again and switch back over to the main/master Droplet.

Would you please advise if this can be done on Digital Ocean? I would greatly appreciate if you provide me with a simple tutorial or hints to do it. I am still beginner to this technology.


1 comment
  • Hi, have you found a solution that you may like to share? I'm considering another type of solution involving polling the main server for http response. Ideally, the polling/monitoring server should be a third server. However, that still means writing and maintaining a script to accomplish that.

1 Answer

While DigitalOcean doesn't offer a load balancing product, we do provide some building blocks for setting up a high availability system. Using Floating IPs, you can bounce an IP address from one server to another. Paired with software like Heartbeat, you can build a system where the IP is automatically moved from one instance to another if one of them falls over. Check out this tutorial for an example:

Heartbeat is an open source program that provides cluster infrastructure capabilities—cluster membership and messaging—to client servers, which is a critical component in a high availability (HA) server infrastructure. Heartbeat is typically used in conjunction with a cluster resource manager (CRM), such as Pacemaker, to achieve a complete HA setup. However, in this tutorial, we will demonstrate how to create a 2-node HA server setup by simply using Heartbeat and a DigitalOcean Floating IP.
Have another answer? Share your knowledge.