On Thu, Sep 27, 2012 at 9:37 PM, Jon Hancock
<jhancock@xxxxxxxxxxxxxxx> wrote:
We have a new pg system on 9.1, just launched inside China. We now know we may need to run a replicate, with some writes to it outside China. Would like some advice. Here are parameters:
1 - Our data center is in Beijing. If we have a replicate in a data center in California, we can expect the bandwidth to vary between the Beijing and California servers and for any connection between the two servers to break down occasionally. How well does pg replication work for suboptimal connects like this?
How do you want things to work when the internet connection goes down?
2 - Is multi-master an option to allow some writes to the otherwise slave California db?
Multi-master replication is inherently problematic. It doesn't matter what system you are using, avoid it if you can. The problem is that multi-master replication typically means "replicate the easy cases and let a programmer figure out what to do if anything looks a little weird." I suppose it might work for some cases but....
I actually think that some sort of loose coupling usually makes better sense than multi-master replication. I recently wrote pg_message_queue to make it easier to implement loose coupling generally. You could, for example, send xml docs back and forth, parse those and save them into your databases. You can't guarantee the C part of the CAP theorem (you pick A and P there), but you can guarantee local data consistency on both sides.
3 - Would trying this on 9.2 be a better place to start? I don't think there is any reason we couldn't migrate up at this point.
The one thing in 9.2 that changes in this area is that it is designed so that if you have multiple servers on each continent, you only replicate data once for each long haul link. I don't think that's applicable to your case though.
Best Wishes,
Chris Travers