From: | Stuart Bishop <stuart(at)stuartbishop(dot)net> |
---|---|
To: | Alberto Olivares <alberto(dot)olivares(at)snowflakesoftware(dot)com> |
Cc: | Matheus de Oliveira <matioli(dot)matheus(at)gmail(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: SQL command in Slave Database - Monitor Replication |
Date: | 2015-07-06 10:08:42 |
Message-ID: | CADmi=6OXXHsB04RdKdDAPbwEYau4oSRTTkTW7aTSvLahjbX7nw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On 6 July 2015 at 15:35, Alberto Olivares
<alberto(dot)olivares(at)snowflakesoftware(dot)com> wrote:
> Hi Matheus,
>
>
> Thanks for your answer. I do not have access to the primary database. So, I
> cannot run a SQL in there.
>
> I need to run the command in the Slave database that tells me whether the
> replication is still working or not.
"SELECT pg_last_xact_replay_timestamp()" gives you the time of the
last write. If it is not increasing, replication is broken or the
primary is idle. If it is NULL, the database is a primary or a
secondary just starting up. I think most of our are monitoring that
lag time is in a certain range - "SELECT (now() -
pg_last_xact_replay_timestamp()) < '5 minutes'::interval"
--
Stuart Bishop <stuart(at)stuartbishop(dot)net>
http://www.stuartbishop.net/
From | Date | Subject | |
---|---|---|---|
Next Message | KhunSanAung | 2015-07-06 10:26:59 | How to assign multiple-users to a Postgres database? |
Previous Message | Alberto Olivares | 2015-07-06 09:58:18 | Re: SQL command in Slave Database - Monitor Replication |