| From: | Holger Jakobs <holger(at)jakobs(dot)com> | 
|---|---|
| To: | pgsql-admin(at)lists(dot)postgresql(dot)org | 
| Subject: | Re: How to test replication without doing a failover | 
| Date: | 2022-11-10 15:52:57 | 
| Message-ID: | 51397c23-b806-eb24-3bd0-986ef9c593c9@jakobs.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-admin | 
Am 10.11.22 um 15:59 schrieb Edwin UY:
> List
>
> 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?
>
> Regards,
> Ed
*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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rafał Kędziorski | 2022-11-11 18:11:25 | Ubuntu 20.04: Problem with postgresql-client-common and postgresql-common upgrade | 
| Previous Message | Paul Smith | 2022-11-10 15:43:26 | Re: How to test replication without doing a failover |