Hello,
I don’t understand very well why you need a dump of the db; if you use that for 
having 2 databases with exactly the same data, then I would proceed like that:

1.       Dump database A

2.       Import dump into target database B

3.       Add your source db to bucardo (bucardo add db A, with tables etc)
bucardo add db db_A dbhost=myhost dbport=5432 dbname=mydbname dbuser=mydbuser 
dbpass=mydbpassword

4.       Add your target db to bucardo (bucardo add db B, with tables etc)
bucardo add db db_B dbhost=myhost_B dbport=5432 dbname=mydbname dbuser=mydbuser 
dbpass=mydbpassword

5.       Create a sync that has:

a.       database A as source, database B as target if you want a master to 
slave replication
bucardo add dbgroup grp_m2s_mydbname db_A:source db_B:target
bucardo add sync sync_mydbname_m2s dbs=grp_m2s_mydbname [‘tables=’]

b.       both databases as source if you want a master to master replication 
(you should choose a conflit resolution strategy,  I use “bucardo_latest”)
bucardo add dbgroup grp_m2m_mydbname db_A:source db_B:source
bucardo add sync sync_mydbname_m2m dbs=grp_m2m_mydbname 
conflict_strategy=bucardo_latest [‘tables=’]

More precisely I created a dbgroup with both databases, and then I add that 
dbgroup to the sync.
The “tables” parameter is optional, to specify a subset of tables to be 
replicated.

6.       Start bucardo

Another option is to use bucardo with the “ONETIMECOPY” parameter, its purpose 
is to copy big amount of data from a db to another and bucardo has this 
possibility, but I don’t know it very well and the dump in my opinion is the 
cleanest method for replica initialization.

Hope this will be useful to you,
Bye!

Mattia Marzo

From: Bucardo-general <[email protected]> On Behalf Of Lucas 
Possamai
Sent: martedì 11 maggio 2021 02:14
To: [email protected]
Subject: Re: [Bucardo-general] Question about order of the Bucardo setup

On Tue, 11 May 2021 at 12:05, Lucas Possamai 
<[email protected]<mailto:[email protected]>> wrote:
Hello,

I tried to find this information online but I couldn't find a proper answer.

The steps I usually take are:

  1.  Add bucardo to my source db (add db, add table, add sequence, etc)
  2.  Dump the database
  3.  Import the database into the target db
  4.  start bucardo

Is that order correct? What if I dump the DB first and then add bucardo to my 
source db, will bucardo know where it needs to replicate from?

... or it doesn't matter the order of the steps, as Bucardo will compare every 
single row in the source and target and will replicate what's missing?
_______________________________________________
Bucardo-general mailing list
[email protected]
https://bucardo.org/mailman/listinfo/bucardo-general

Reply via email to