What is the best way to synchronize data and databases across droplets for global traffic direction?

May 1, 2015 1.6k views
Deployment Clustering Ubuntu

I am trying to configure 3 servers to be placed around the world for quicker response time though how can I keep the data identical across all machines say I was running a wordpress or ghost website? And of course having this process automated

Thank you

1 comment
  • This is a really difficult thing to setup, and for just 3 locations it might not be worth it. The easiest approach would be to make the websites as static as possible, and then replicate only the static html/media files to the other 2 locations from a main master location. There are a bunch of WP plugins that you can use to cache out html files, and a crontab to copy the files nightly would be easier. How you setup the DNS is something I haven't been able to figure out.

1 Answer


I am currently working on something like this. For WordPress and WHMCS. It is hard, but not impossible. There are several routes that you can take in achieving this. The only problem I have at the moment is storage replication/synchronizing between data centers. In my case this has to be almost real time due to the nature of the app. If you can live with some latency (5 minutes) you can try lsync+unison to sync your files on changes.

For database replication I went for a Percona Galera Cluster with a master in each datacenter. The setup is quite easy. This article is a good starting point:
(Small tip that will save you hours of troubleshooting: Stop every mysql instance on every node if you bootstrap your cluster, otherwise mysql won't start)

Your visitors will need to be directed to the right server, this can easily be done with GeoDNS. You have two options here. Work with your own DNS servers (Look for docker/cookood, Powerdns or Bind on google) or a managed DNS provider. For simplicity and testing I recommend the last option. Rage4DNS and edgedirector are a solid and fairly priced GeoDNS providers.

To make things a bit more secure and to encrypt traffic between your servers, I have created a Tinc mesh network. Search for Ansible Tinc on DigitalOcean and you will find an awesome tutorial explaining how to achieve and automate this.

I am writing an article about this, when it is finished I'll keep you updated. It will be an in depth explanation about a high available globally distributed WordPress Multisite with GeoDNS. As I said before, it is hard and it will take a long time to make this setup work.

Have another answer? Share your knowledge.