How it works...

As with Slony, we need to begin by duplicating table structures to the subscriber. Bucardo only copies data and assumes that the source and target tables have the exact same columns. Therefore, we use pg_dump to obtain a schema-only (-s) extract of any table that begins with pgbench (-t 'pgbench*'). Using the -h parameter, we can execute the resulting SQL on the subscriber database and create all of the pgbench tables as empty shells.

After copying the table definitions, we can use the bucardo tool for all of the remaining steps. The first of these include configuring Bucardo to recognize each table we want to replicate. The add table parameter does this. By adding the db=pgha1 segment, we explicitly state which database owns ...

Get PostgreSQL 12 High Availability Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.