Logical replication
One of the new features of PostgreSQL 10 is logical replication.
Logical replication is a method of replicating data objects and their changes, based upon their replication identity (usually a primary key). We use the term logical in contrast to physical replication, which uses exact block addresses and byte-by-byte replication. PostgreSQL supports both mechanisms concurrently.
Logical replication uses a publish and subscribe model with one or more subscribers subscribing to one or more publications on a publisher node. Subscribers pull data from the publications they subscribe to and may subsequently re-publish data to allow cascading replication or more complex configurations.
The concept is quite simple, a publication is created on the database master and a subscription is created on the slaves.
On the master (Node 1
), we have to perform the following steps:
- Set
wal_level
tological
onpostgresql.conf
- Create the role
REPLICATION
- Give the right permissions to the tables that...