Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 93D4DB5DBC1 for ; Fri, 26 Aug 2011 13:20:57 -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 28219-05 for ; Fri, 26 Aug 2011 16:20:51 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.dhs-club.com (mail.dhs-club.com [208.69.229.2]) by mail.postgresql.org (Postfix) with ESMTP id 39BD3B5DBE8 for ; Fri, 26 Aug 2011 13:20:51 -0300 (ADT) Received: from [192.168.0.11] (hq.clubshop.com [208.78.129.189]) (authenticated bits=0) by mail.dhs-club.com (8.13.1/8.13.1) with ESMTP id p7QGKmK5007345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 26 Aug 2011 12:20:49 -0400 Message-ID: <4E57C7DC.7020508@dhs-club.com> Date: Fri, 26 Aug 2011 12:20:44 -0400 From: Bill MacArthur User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: how to tell if a replication server has stopped replicating Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.67 on 208.69.229.2 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.682 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.502, SARE_SPEC_REPLICA=0.72 X-Spam-Level: X-Archive-Number: 201108/211 X-Sequence-Number: 38198 Hello, 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=postgres host=192.168.17.4 port=53542 2011-08-26 00:00:05 PDT postgres 192.168.17.4 [unknown]FATAL: requested WAL segment 00000001000001D10000006B has already been removed 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? Thank you, Bill MacArthur