Re: replicate or multi-master for 9.1 or 9.2

From: Chris Travers <chris(dot)travers(at)gmail(dot)com>
To: Jon Hancock <jhancock(at)shellshadow(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: replicate or multi-master for 9.1 or 9.2
Date: 2012-09-28 06:27:30
Message-ID: CAKt_Zfvssdij=dLANeyWKvm8+9iqJN_hEEfKdm584-u3pcLTXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 27, 2012 at 9:37 PM, Jon Hancock <jhancock(at)shellshadow(dot)com>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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-09-28 07:36:46 Re: Re: Need help in reclaiming disk space by deleting the selected records
Previous Message John R Pierce 2012-09-28 06:11:14 Re: replicate or multi-master for 9.1 or 9.2