Fwd: Monitoring Replication on Master/Slave Postgres(9.1)

From: Shams Khan <shams(dot)khan22(at)gmail(dot)com>
To: stuart(at)stuartbishop(dot)net, pgsql-admin(at)postgresql(dot)org
Subject: Fwd: Monitoring Replication on Master/Slave Postgres(9.1)
Date: 2012-11-27 09:39:30
Message-ID: CAM42bopixMf9WLDZVo5U-T0eNyamKmObtcKG+ziFZT1kzLDJQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks for the response Stuart...It was really helpful:

Below are some doubts I wanted to clarify..please read and suggest.
Can we also check if replication was broken earlier...somehow due to power
failure of some other reasons in past...The reason I am asking is I am
getting some discrepancies in data between master and slave...? I want to
know the reason of it...

thanx

---------- Forwarded message ----------
From: Stuart Bishop <stuart(at)stuartbishop(dot)net>
Date: Tue, Nov 27, 2012 at 2:03 PM
Subject: Re: [ADMIN] Monitoring Replication on Master/Slave Postgres(9.1)
To: Shams Khan <shams(dot)khan22(at)gmail(dot)com>

On Mon, Nov 26, 2012 at 5:05 PM, Shams Khan <shams(dot)khan22(at)gmail(dot)com> wrote:
> HI All,
>
> I want to know the ways to monitor the replication, whether the master and
> slave server are sync.

On the slave, run "SELECT now() - pg_last_xact_replay_timestamp() AS
time_lag;". That tells you how far behind in time the slave is.

> My question is how do we read these numbers(17A/342A6F78 and
17A/34366C30) I
> never got the same results on both servers. Is that mean slave is not
synced
> with master?

With asynchronous replication, the slave will always lag behind the
master. The query I posted above will tell you by how much.

--
Stuart Bishop <stuart(at)stuartbishop(dot)net>
http://www.stuartbishop.net/

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Krawetzky, Peter J 2012-11-27 14:39:36 WAL Backup Error
Previous Message Stuart Bishop 2012-11-27 08:34:35 Re: Monitoring Replication on Master/Slave Postgres(9.1)