Using PostgreSQL Streaming Replication

Prev Next

Streaming replication enables the continuous streaming and replication of WAL segments from the WAL directory and archived WAL segments from a primary database server to a secondary database server.

The following diagram illustrates streaming replication with continuous archiving and point-in-time recovery:
image.png

Note

Syncing archived WAL segments is done only on the first setup of the replica.

This process is complementary to configuring continuous archiving. It protects against failures occurring on the primary database server, by streaming the WAL directory and synchronizing the database's archived WAL logs to a secondary database server.

Note

You can also configure the replication so that the archive pool is on the passive, secondary, database and not the active database server with point-in-time recovery on the secondary.
image.png

Configuring PostgreSQL Streaming Replication

The secondary server continuously streams the primary server’s WAL segments, and synchronizes the primary database server’s archived WAL segments every 10 minutes. Streaming replication traffic runs on TCP port 5432, which means you must open these ports for communication between the primary and secondary database servers. The secondary CTERA database server acts as a standby/passive server and cannot be used for load balancing purposes.

Notes

The allocated disk space for the PostgreSQL archive pool must be at least twice the size of the storage space allocated for the CTERA Portal data pool, as described in Calculating the Minimum Space Required for the Database Backup.

The locations of the streaming and archived WAL segments are $pgdatadir/pg_wal and $DBarchive respectively.

To configure streaming replication: