<div dir="ltr"><div dir="ltr">Hello,</div><div dir="ltr"><br></div><div dir="ltr">Just to help someone who's looking for the same kind of information in the future.</div><div dir="ltr"><br></div><div>I have done the steps as Mattia mentioned, and they did not work for me.</div><div>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.</div><div><br></div><div>Instead, I had to do the following steps:</div><div><ol><li>Take a pg dump of the schema only from my source db (EC2)</li><li>Import the schema into my target db (RDS)</li><li>Set up bucardo</li><ol><li>bucardo add db (source)</li><li>bucardo add db (target)</li><li>bucardo add tables</li><li>bucardo add sequences</li><li>bucardo add dbgroup</li><li>bucardo add sync with autokick=0</li><li>bucardo validate sync</li></ol><li>Take a pg_dump (data only) of the source db</li><li>Disable RDS backups and remove MultiAZ (if enabled)</li><li>Disable triggers and FKs to speed up the import</li><li>import the dump into RDS (data only)</li><li>Enable triggers and FKs in target db</li><li>Modify the RDS parameter group to add "session_replication_role = replica"</li><li>Reboot RDS</li><li>Start Bucardo replication</li><ol><li>bucardo update sync geoop_sync autokick=1<br></li><li>bucardo start</li></ol></ol><div><br></div><div><ul><li>Just a reminder that my source db has traffic to it at all times. The process above is to replicate a live DB.</li></ul></div><div><br></div><div>Cheers!</div></div><div dir="ltr"><br clear="all"><div><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div></div><div>---<br></div><div>Kind regards,</div><b><br></b></div><div dir="ltr"><b>Lucas Possamai</b></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 11 May 2021 at 22:58, Lucas Possamai <<a href="mailto:drum.lucas@gmail.com" target="_blank">drum.lucas@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Tue, 11 May 2021 at 19:53, IT Technical Analyst FOD <<a href="mailto:fo.ittechnicalanalyst@emergency.it" target="_blank">fo.ittechnicalanalyst@emergency.it</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="IT">
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Hello,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">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:<u></u><u></u></span></p>
<p><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><span>1.<span style="font:7pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Dump database A<u></u><u></u></span></p>
<p><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><span>2.<span style="font:7pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Import dump into target database B<u></u><u></u></span></p>
<p><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><span>3.<span style="font:7pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Add your source db to bucardo (bucardo add db A, with tables etc)<br>
</span><span lang="EN-US" style="font-size:10pt;font-family:"Courier New"">bucardo add db db_A dbhost=myhost dbport=5432 dbname=mydbname dbuser=mydbuser dbpass=mydbpassword</span><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
<p><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><span>4.<span style="font:7pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Add your target db to bucardo (bucardo add db B, with tables etc)<br>
</span><span lang="EN-US" style="font-size:10pt;font-family:"Courier New"">bucardo add db db_B dbhost=myhost_B dbport=5432 dbname=mydbname dbuser=mydbuser dbpass=mydbpassword</span><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
<p><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><span>5.<span style="font:7pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Create a sync that has:<u></u><u></u></span></p>
<p style="margin-left:72pt">
<u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><span>a.<span style="font:7pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">database A as source, database B as target if you want a master to slave replication<br>
</span><span lang="EN-US" style="font-size:10pt;font-family:"Courier New"">bucardo add dbgroup grp_m2s_mydbname db_A:source db_B:target<br>
bucardo add sync sync_mydbname_m2s dbs=grp_m2s_mydbname [‘tables=’]</span><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
<p style="margin-left:72pt">
<u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><span>b.<span style="font:7pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">both databases as source if you want a master to master replication (you should choose a conflit resolution
 strategy,  I use “<i>bucardo_latest</i>”)<br>
</span><span lang="EN-US" style="font-size:10pt;font-family:"Courier New"">bucardo add dbgroup grp_m2m_mydbname db_A:source db_B:source<br>
bucardo add sync sync_mydbname_m2m dbs=grp_m2m_mydbname conflict_strategy=bucardo_latest [‘tables=’]</span><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>
<p><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">More precisely I created a dbgroup with both databases, and then I add that dbgroup to the sync.<br>
The “tables” parameter is optional, to specify a subset of tables to be replicated.<u></u><u></u></span></p>
<p><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><span>6.<span style="font:7pt "Times New Roman"">      
</span></span></span><u></u><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Start bucardo</span></p></div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>Cheers!</div></div></div>
</blockquote></div></div>