Report this

What is the reason for this report?

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

Posted on May 1, 2015

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



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey,

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: https://www.percona.com/blog/2012/01/11/making-the-impossible-3-nodes-intercontinental-replication/ (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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.