[Bucardo-general] Question about order of the Bucardo setup

Lucas Possamai drum.lucas at gmail.com
Mon May 17 10:44:13 UTC 2021


Hello,

Just to help someone who's looking for the same kind of information in the
future.

I have done the steps as Mattia mentioned, and they did not work for me.
If I take a dump of the database and import it into my target db, before
setting up bucardo, the changes that happened between pg_dump and the
activation of Bucardo, won't be replicated.

Instead, I had to do the following steps:

   1. Take a pg dump of the schema only from my source db (EC2)
   2. Import the schema into my target db (RDS)
   3. Set up bucardo
      1. bucardo add db (source)
      2. bucardo add db (target)
      3. bucardo add tables
      4. bucardo add sequences
      5. bucardo add dbgroup
      6. bucardo add sync with autokick=0
      7. bucardo validate sync
   4. Take a pg_dump (data only) of the source db
   5. Disable RDS backups and remove MultiAZ (if enabled)
   6. Disable triggers and FKs to speed up the import
   7. import the dump into RDS (data only)
   8. Enable triggers and FKs in target db
   9. Modify the RDS parameter group to add "session_replication_role =
   replica"
   10. Reboot RDS
   11. Start Bucardo replication
      1. bucardo update sync geoop_sync autokick=1
      2. bucardo start



   - Just a reminder that my source db has traffic to it at all times. The
   process above is to replicate a live DB.


Cheers!

---
Kind regards,

*Lucas Possamai*

On Tue, 11 May 2021 at 22:58, Lucas Possamai <drum.lucas at gmail.com> wrote:

> On Tue, 11 May 2021 at 19:53, IT Technical Analyst FOD <
> fo.ittechnicalanalyst at emergency.it> wrote:
>
>> 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
>>
>
> Yep, that makes sense! I was actually setting up bucardo (adding DB,
> tables, sequence, sync, etc) prior dumping and restoring the DB in the
> target... but the way you do it is the same way Frank does it, as per his
> emails... so that's great. That's what I was looking for.
>
> Cheers!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://bucardo.org/pipermail/bucardo-general/attachments/20210517/820189e8/attachment.htm>


More information about the Bucardo-general mailing list