Re: Monitoring Replication - Postgres 9.2

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Monitoring Replication - Postgres 9.2
Date: 2016-11-30 01:10:53
Message-ID: CAJNY3it=PGiKQncUhBbSdfwzX6dWSvo4sShM6M4TXuThRt58tw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2016-11-30 14:02 GMT+13:00 John R Pierce <pierce(at)hogranch(dot)com>:

> On 11/29/2016 3:31 PM, Patrick B wrote:
>
> I use these queries to monitor the streaming replication:
>
> *on master:*
> select client_addr, state, sent_location, write_location, flush_location,
> replay_location, sync_priority from pg_stat_replication;
>
> *On slave:*
> select now() - pg_last_xact_replay_timestamp() AS replication_delay;
>
> Can I create a table to store that data?
>
>
> sure, why not ? do you want this table to just have one row with the
> last value you stored? or do you want to store a history with timestamp ?
>
> I also need the data is constantly put into this table. How would be the
> best way to do it?
>
>
> um, that data changes continuously, what do you mean, 'constantly' ? if
> you mean once a minute or something, use a script that samples the data and
> stores it in your table, and waits a minute, then repeats. if you mean
> literally continously, why not just query the data as you have, thats the
> 'live' value ... you oculd use a view, I suppose.
>
>
> --
> john r pierce, recycling bits in santa cruz
>
>
Yep.. once a minute or so. And yes, I need to store a history with
timestamp.

Any idea? :)

Thanks!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2016-11-30 01:21:31 Re: Monitoring Replication - Postgres 9.2
Previous Message John R Pierce 2016-11-30 01:02:28 Re: Monitoring Replication - Postgres 9.2