0% found this document useful (0 votes)
3 views

Halting and Resuming Replication In PostgreSQL

The document discusses halting and resuming physical streaming replication in PostgreSQL, detailing how to manage WAL records between primary and standby servers. It provides specific commands to check the status of WAL replay and to pause or resume it on both the primary and standby servers. The primary server is identified as 10.20.30.74 and the standby server as 10.20.30.75, with instructions on monitoring replication lag metrics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Halting and Resuming Replication In PostgreSQL

The document discusses halting and resuming physical streaming replication in PostgreSQL, detailing how to manage WAL records between primary and standby servers. It provides specific commands to check the status of WAL replay and to pause or resume it on both the primary and standby servers. The primary server is identified as 10.20.30.74 and the standby server as 10.20.30.75, with instructions on monitoring replication lag metrics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Zohaib Riaz DBA (Cell:+44 7488 496808)

Physical streaming replication

Halting and Resuming Replication In PostgreSQL

Sometimes we want WAL records should flow from primary to standby, and WAL records should be flushed to
disk on standby but should not replay, which means WAL records should be stored on remote WAL segments
but should not be restored on standby.

Physical streaming replication is working on mac4 and mac5

Primary Server = 10.20.30.74 (mac4)

Standby Server = 10.20.30.75 (mac5)

On standby server

select pg_is_wal_replay_paused();

select pg_wal_replay_pause();

Zohaib Riaz DBA (Cell:+44 7488 496808)

On Primary Server

Insert a row in cars table of 'zohaib' database

select * from pg_stat_replication;

and have a look at write_lag, flush_lag, replay_lag


Zohaib Riaz DBA (Cell:+44 7488 496808)

On standby server

select pg_wal_replay_resume();

On Primary Server

select * from pg_stat_replication; and have a look at write_lag, flush_lag, replay_lag


sent_lsn: wal records are sent to replica

write_lsn: wal records are written to Operating System cache but not written to disk.

flush_lsn: wal records are written to Disk from Operating System cache.

replay_lsn: means records are applied to database.

You might also like