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 the remaining steps. The first of these include configuring Bucardo to recognize each table we want to replicate. The add table parameter to bucardo does this. By adding the db=pg1 segment, we explicitly state which database ...

Get PostgreSQL High Availability Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.