Check Replication lag

Started by Pawan Sharmaover 4 years ago3 messagesgeneral
Jump to latest
#1Pawan Sharma
pawanpg0963@gmail.com

Hello Team,

Is there a way to monitor the replication lag, where replica nodes are
configured through aws s3.

Is not in a synced replica setup where master node will push the wal files
to aws s3 and we are taking and replaying those wal files on a replica node.

-Pawan

In reply to: Pawan Sharma (#1)
Re: Check Replication lag

On Mon, Oct 11, 2021 at 05:58:03PM +0530, Pawan Sharma wrote:

Is there a way to monitor the replication lag, where replica nodes are
configured through aws s3.

You can check it on replica, by issuing:
select now() - pg_last_xact_replay_timestamp();

and it will show you, more or less, what is your current lag.

Best regards,

depesz

#3Pawan Sharma
pawanpg0963@gmail.com
In reply to: hubert depesz lubaczewski (#2)
Re: Check Replication lag

Hello Depesz,

Thanks for your quick response, let me give some overview of our cluster
setups. Actually we have a Patroni cluster running with one replica
(Replica 1) in the same data center with no data lag. whereas we have
configured one more replica(Replica 2) in a different data center
through AWS S3 WAL shipping and replaying.

So we can easily check Patroni replica (Replica1) lag using the patronictl
list command. but I am looking how I can check replication lag of Replica 2
which is configured through AWS.

As I have checked with above query I am getting same response from both the
replicas. whereas on Replica2 there is some lag exist.

I have created dummy table on master node and its synced on replica1
simultaneously but it taking hours to sync on replica2.

Regards,
Pawan

On Mon, Oct 11, 2021 at 6:22 PM hubert depesz lubaczewski <depesz@depesz.com>
wrote:

Show quoted text

On Mon, Oct 11, 2021 at 05:58:03PM +0530, Pawan Sharma wrote:

Is there a way to monitor the replication lag, where replica nodes are
configured through aws s3.

You can check it on replica, by issuing:
select now() - pg_last_xact_replay_timestamp();

and it will show you, more or less, what is your current lag.

Best regards,

depesz