Re: SQL command in Slave Database - Monitor Replication

Поиск
Список
Период
Сортировка
От Stuart Bishop
Тема Re: SQL command in Slave Database - Monitor Replication
Дата
Msg-id CADmi=6OXXHsB04RdKdDAPbwEYau4oSRTTkTW7aTSvLahjbX7nw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: SQL command in Slave Database - Monitor Replication  (Alberto Olivares <alberto.olivares@snowflakesoftware.com>)
Список pgsql-admin
On 6 July 2015 at 15:35, Alberto Olivares
<alberto.olivares@snowflakesoftware.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@stuartbishop.net>
http://www.stuartbishop.net/


В списке pgsql-admin по дате отправления:

Предыдущее
От: Alberto Olivares
Дата:
Сообщение: Re: SQL command in Slave Database - Monitor Replication
Следующее
От: KhunSanAung
Дата:
Сообщение: How to assign multiple-users to a Postgres database?