PostgreSQL supports logical replication and logical decoding built into the source starting from PostgreSQL 10. For versions prior to PostgreSQL 10, there is an extension called pglogical. This extension can be used to configure replication between PostgreSQL 9.6 to PostgreSQL 13 so that the downtime can be minimized. In this recipe, we shall see how pglogical can be installed in the PostgreSQL 9.6 and PostgreSQL 13 versions.
Note: The older-version PostgreSQL cluster may be called the provider or the publisher and the newer-version node may be called the subscriber.
Getting ready
The pglogical extension replicates tables that have a primary key only. It works for replicating PostgreSQL versions starting from PostgreSQL 9.4.x to any version higher than 9.4. So, if the Postgres version is 9.3 or older, pglogical would not serve the purpose.
How to do it...
We will do this using the following steps:
- Set up the...