Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a site which is located in US and I want to set up a mirror site in China, the site is using PHP + MYSQL and the network quality between two servers is terrible.

I tried set up a database-sync between two mysql databases but, there will always be conflicts due to the bad network quality (extremely high latency, packet loss, and sometimes cannot establish a connection at all).

Is there any better way to do the mirroring?

share|improve this question
    
is the mirror going to need sync back the main server or can it be a simple slave? do you need up to the minute syncing if a slave is ok? –  anthonysomerset May 3 '11 at 8:47
    
the mirror needs to sync back, so conflicts are everywhere when network goes terrible. –  Felix Yan May 3 '11 at 9:18
add comment

3 Answers

up vote 1 down vote accepted

Many organizations deal with this challenge. There are a number of standard approaches:

  1. Mirror the static portions of the site to the remote region so that the amount of data fetched from a distant server is minimized. This can be enabled by a CDN or by your own DNS-based load balancing system, e.g. F5 GTM for an images sub-domain, etc.
  2. Parition the site by region with mostly unique content in each partition and some manual or automatic content duplication when needed (possibly enabled by the CMS.)
  3. Use a network acceleration service like akamai to serve your centrally hosted content to remote regions on faster network. The service doesn't mirror your content, rather it provides optimized path between the user and you with higher reliability and lower latency.

In certain circumstances, you might have a dynamic site that isn't edited very often. Rather than continuous database replication, you might take a snapshot approach. This would involve making frequent backups, copying them to the remote server, and restoring them on a schedule.

share|improve this answer
add comment

I tried set up a database-sync between two mysql databases but, there will always be conflicts due to the bad network quality

I assume you mean conflicting data updates.

Then the only practical solution is to partition the systems as much as possible - which rather undermines the availaiblity of the system, and will probably require code changes unless you can isolate them completely.

share|improve this answer
add comment

If you really need to do this why don't you use MySQL multi master replication aka MySQL circular replication link

Given the bad network conditions there will be replication delays hence your selects would have inconsistent results but the replication should still work fine. Another feasible option might be to host in HK where you would get better network connectivity..

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.