pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Toby Corkindale <toby.corkindale@strategicdata.com.au>
To: pgsql-general@postgresql.org
Subject: Re: Async replication: how to get an alert on failure
Date: Thu, 02 Aug 2012 12:50:00 +1000
Message-ID: <5019EAD8.9090908@strategicdata.com.au> (raw)
In-Reply-To: <BLU0-SMTP36295E42C95BA31416DD9C9CFCB0@phx.gbl>
References: <5019ADE5.4050800@simkorp.com.br>
	<BLU0-SMTP36295E42C95BA31416DD9C9CFCB0@phx.gbl>

On 02/08/12 10:04, Edson Richter wrote:
> I have few PostgreSQL servers established with replication.
> Now, is there any way to receive an e-mail in case of error during
> synchronization?
> I mean, is there an script (cron?) I can run (maybe every 5 minutes)
> that will check if replication is stolen, and send an e-mail in case of
> failure?

I created a little Perl script that just connects to the master and 
queries the pg_stat_replication statistics.

It notes if (a) the client has disconnected entirely, or (b) if the 
client's replay position has still not reached the position that the 
master was in last time we checked. (So if you run the check every five 
minutes, you'll get a warning if the client is more than five minutes 
lagged behind the master)



view thread (6+ messages)  latest in thread

Message-ID: <5019EAD8.9090908@strategicdata.com.au>
Permalink:  ../5019EAD8.9090908@strategicdata.com.au/
Also on:    postgresql.org/message-id/5019EAD8.9090908@strategicdata.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: toby.corkindale@strategicdata.com.au
  Subject: Re: Async replication: how to get an alert on failure
  In-Reply-To: <5019EAD8.9090908@strategicdata.com.au>
  References: <5019ADE5.4050800@simkorp.com.br> <BLU0-SMTP36295E42C95BA31416DD9C9CFCB0@phx.gbl> <5019EAD8.9090908@strategicdata.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox