Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 48B1CB5DC09 for ; Sat, 27 Aug 2011 00:05:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 98085-04 for ; Sat, 27 Aug 2011 03:04:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gy0-f174.google.com (mail-gy0-f174.google.com [209.85.160.174]) by mail.postgresql.org (Postfix) with ESMTP id A7C78B5DBDE for ; Sat, 27 Aug 2011 00:04:49 -0300 (ADT) Received: by gya6 with SMTP id 6so3366004gya.19 for ; Fri, 26 Aug 2011 20:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type:content-transfer-encoding:x-mailer :thread-index:content-language; bh=v0ifBG1GG9g91/U84B6rmD5Ywq4SK1R7FE/mUCWVJlM=; b=BpymEg9/GFoBCd2I5PvNozrA9U6u+Qegg5YK7Kya9oRyIejVz18XWsNM5vRz8V73ZD jdF3kNmb1oFDu2id+F1qag/2mJ9cVTXFULdo9tzoQBXsbkL2LWd/+hbDsjQm9TVmBWHT ibAYpDKug7wMP60b1MUUy5jAtKucyoSdZRDgk= Received: by 10.231.26.68 with SMTP id d4mr3854596ibc.66.1314414288367; Fri, 26 Aug 2011 20:04:48 -0700 (PDT) Received: from Duality (67-40-130-232.hlrn.qwest.net [67.40.130.232]) by mx.google.com with ESMTPS id d9sm923246ibt.33.2011.08.26.20.04.46 (version=SSLv3 cipher=OTHER); Fri, 26 Aug 2011 20:04:47 -0700 (PDT) From: "mark" To: "'Bill MacArthur'" Cc: References: <4E57C7DC.7020508@dhs-club.com> In-Reply-To: <4E57C7DC.7020508@dhs-club.com> Subject: Re: how to tell if a replication server has stopped replicating Date: Fri, 26 Aug 2011 21:05:01 -0600 Message-ID: <005601cc6466$1d7e73d0$587b5b70$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcxkDCy+mBrTdijmTXi5tSBHABH2cQAV1Ygw Content-Language: en-us X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.179 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, SARE_SPEC_REPLICA=0.72 X-Spam-Level: X-Archive-Number: 201108/216 X-Sequence-Number: 38203 > -----Original Message----- > From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin- > owner@postgresql.org] On Behalf Of Bill MacArthur > Sent: Friday, August 26, 2011 10:21 AM > To: pgsql-admin@postgresql.org > Subject: [ADMIN] how to tell if a replication server has stopped > replicating >=20 > Hello, >=20 > We recently discovered, quite by accident, that our streaming > replication server was no longer replicating. We noticed this in our > master server log file: > 2011-08-26 00:00:05 PDT postgres 192.168.17.4 [unknown]LOG: > replication connection authorized: user=3Dpostgres host=3D192.168.17.4 > port=3D53542 > 2011-08-26 00:00:05 PDT postgres 192.168.17.4 [unknown]FATAL: > requested WAL segment 00000001000001D10000006B has already been = removed >=20 > As it turned out this has been going on for at least a week as > everyday's log files were crammed with these messages. Whatever caused > the replication server to end up needing the WAL file is a mystery for > another day. What I would like to do is setup a simple method of > alerting us if replication stops. We could do a simple grep of log > files on the replication side, but I am guessing that there is some = SQL > command that could be run against the postgres internals that would be > cleaner. Is there such an animal? >=20 > Thank you, > Bill MacArthur >=20 * http://archives.postgresql.org/pgsql-hackers/2010-11/msg00198.php * http://archives.postgresql.org/pgsql-hackers/2010-11/msg00252.php=20 Those two posts should cover the basics. There are other ways some = people use to do it, but this seems to be the generally accepted way.=20 I think 9.1 has some stuff in the works that should make it far easier = to monitor.=20 -Mark =20