Setting up pglogical
PostgreSQL 9.4 introduced a feature called replication slots. This essentially makes it possible to decode the transaction log and extract database traffic for remote replay at a logical level. Unlike standard replication that requires the primary and replica to be identical, slots can be mined for specific information relevant to user needs.
One of the first PostgreSQL extensions to make use of replication slots is pglogical by 2ndQuadrant. Like Slony, Bucardo, and Londiste, pglogical can copy individual tables from one database to another. Unlike those other pieces of software, it does so without encumbering tables with performance-robbing triggers, and does not rely on an external daemon to coordinate data copy streams.
Let's get it running.
Getting ready
The latest version of pglogical at the time of writing this book is 1.2.1. Obtain a copy of the source code from the following URL:
https://github.com/2ndQuadrant/pglogical
The pglogical extension also requires several...