Re: How to test replication without doing a failover

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Am 10.11.22 um 15:59 schrieb Edwin UY:

Very newbie here on PostgreSQL coming from an Oracle DBA background mostly

How do I test and confirm whether replication is working or not besides depending on just running the SQL below?

select pg_is_in_recovery() ;

select * from pg_stat_replication ;

Is it possible to force/initiate a log transaction and see if that gets replicated or not? I mean for example on Oracle we can do a switch logfile and check if that log gets shipped across and applied on the standby, is there something similar in PostgreSQL?
Maybe someone can refer me to an example if there is one somewhere?


Monitoring the replication

Compare the WAL positions of primary and secondary: select pg_current_wal_lsn(); on the primary
select pg_last_wal_receive_lsn(); on the standby or in the ps output of WAL receiver process.

Using the view pg_stat_replication

Check the difference between pg_current_wal_lsn() and the column sent_lsn of the view shows high load of the primary.
Difference between the column sent_lsn of the view and pg_last_wal_receive_lsn() on the standby shows network congestion or that the standby has high load.

Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux