Sync data between two hosts

I would like to host my website on two hosting providers and need advice on how I will synchronize the data [files and databases] between two servers.
I understand that i need to configure the name servers of the two hosting providers but how will I be able to synchronize the data between the two servers to keep it up-to-date?

What is your goal for having these two hosting operations?

Simply standing up two copies of your site in two locations often invites failure.

For one, if you have a database driven site, then you have to keep the databases in sync. This will require master-master replication between the databases. This is use often but something you would have to monitor carefully to assure things work as planned.

If you have user contributed content, then you need a mechanism to keep files in sync in both directions. There are tools for this but once again, you may be inviting a lot of complexity that is not required to reach your goal.

Also, you would need to make sure the data you send between the two servers is encrypted.

Network Problems
If you are trying to do this over the public network, then how will you deal with network issues between the two systems. The two systems may respond perfectly fine but cannot communicate with each other. This will throw all sorts of wrinkles into your operations.

If your really need geographically redundant hosting, then you would want a:
Private network between the different locations
Global Server Load Balancer
Dedicated servers
and more …
This suddenly becomes very pricey.

What you may want to consider is having primary operations at once location and then have an off-site backup that you can easily restore should disaster strike.


Just setting the name servers for your domain to those of both hosts isn’t going to give you the redundancy you are looking for - and will likely lead to a great deal of problems, as each hosts DNS servers will only list their own in the DNS zone and not those of the other host, which can cause some major issues.

As for keeping in sync - that all depends what level of server access you have and what type of data we are talking about.


thanks a lot for the advice, the main reason why i was planning to host my website on two servers was that i have been having problems with my current server. my website experiences a lot of down times and i was hoping that once the first host goes down, the load would be taken on by the second server.