[Bucardo-general] overlapping master/slave replication, and rules on the slave

Rosser Schwarz rosser.schwarz at gmail.com
Mon Mar 22 15:15:36 UTC 2010


On Mon, Mar 22, 2010 at 7:47 AM, Joshua Tolley <josh at endpoint.com> wrote:
> On Mon, Mar 22, 2010 at 05:21:11PM +1100, Nick Farrell wrote:
>> I've looked over the Bucardo documentation, and am not sure whether a
>> particular configuration is supported. What would happen if I ran
>> multiple instances of Bucardo, each one replicating a different remote
>> database to a single central database?

> Bucardo would try to insert both rows into its copy of foo, and fail, because
> it would violate the uniqueness constraint on the id column.

If, however, you can guarantee some form of uniqueness in the primary
keys across your master nodes, you should be fine.  For example,
suppose you used a sequence for your primary keys.  Assuming N
masters, to ensure that the values obtained from those sequences will
never conflict, you could say:

On master 1:

ALTER SEQUENCE seq_name RESTART 1 INCREMENT N;

On master 2:

ALTER SEQUENCE seq_name RESTART 2 INCREMENT N;

...

On master N:

ALTER SEQUENCE seq_name RESTART N INCREMENT N;

If you have non-sequence-based primary keys that somehow otherwise
guarantee uniqueness across the set of rows generated on all your
master nodes, that should work, too.  The trick is ensuring that rows
are globally uniquely identified, across all of your masters.
Otherwise, as Joshua observes, you'll run into trouble with the
uniqueness constraint of the primary key on the central slave.

rls

-- 
:wq


More information about the Bucardo-general mailing list