[Bucardo-general] Just a couple of questions...
rosser.schwarz at gmail.com
Mon Feb 21 18:16:35 UTC 2011
On Mon, Feb 21, 2011 at 9:33 AM, Alessandro Sironi
<alessandro.sironi at loginet.it> wrote:
> does Bucardo lock the slave's table?
No, it doesn't, except insofar as doing anything with any table in
PostgreSQL will lock that table in at least "Access Share" mode, which
basically means, "I'm using this table right now, so you can't DROP
it." Reads and writes will work normally.
Based on your description, it sounds like any writes to the slave's
subscriber table don't need to be replicated back to the master. Is
> It support only 2 master?
Currently, "swap" syncs -- Bucardo terminology for master-master
replication -- only support two nodes. There's word that will change
with Bucardo 5, but AFAIK, there's no ETA for when that will ship, or
even be ready for testing.
In the interim, you can get the desired behavior using multiple
"push-delta" syncs, or master-slave replication sets. For three
masters, named A, B, and C, the setup looks something like this:
A push-delta -> B, C
B push-delta -> A, C
C push-delta -> A, B
You'll need to take care to make sure that the primary keys of the
tables being replicated don't overlap (but you'd need to do that for
both sides of a swap sync, anyway; this isn't a special requirement
for cobbling together more than two masters).
If you're using a synthetic key based off a sequence, you can simply
stagger the sequences using the INCREMENT and START clauses to
CREATE/ALTER SEQUENCE, so that the INCREMENT is the number of masters
and each master gets a different START. E.g.:
On A: CREATE SEQUENCE foo INCREMENT 3 START 1;
On B: CREATE SEQUENCE foo INCREMENT 3 START 2;
On C: CREATE SEQUENCE foo INCREMENT 3 START 3;
If you're using a natural key, you'll have to come up with some other
mechanism. IIRC, another Bucardo user prepends a string identifying
the originating server to her string-based natural keys, for example.
More information about the Bucardo-general