Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id B8B02B5D8B2 for ; Fri, 20 May 2011 08:54:01 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 40318-08 for ; Fri, 20 May 2011 11:53:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iy0-f174.google.com (mail-iy0-f174.google.com [209.85.210.174]) by mail.postgresql.org (Postfix) with ESMTP id 591E1B5D832 for ; Fri, 20 May 2011 08:53:54 -0300 (ADT) Received: by iyb14 with SMTP id 14so2868939iyb.19 for ; Fri, 20 May 2011 04:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Mk8wgFA9RaeAroiTtUj5W5E2Fl3OK6HJnKc58j719jM=; b=OQMecmJGomXjCq+hsX3Aq9JiphKLE3Hfz3+J+hBGjz6qqokC7dDy1yPz1Vlwpl68HD n66K/3A/YwBwL2nEeNfHXmIF4W13aXljyuUykgWKCaVH/6SlPZxMIN9zzJ/kapUpTp69 x3jy42dSZLB6tiGUhtLxNvJFOglbXkmFrwzWg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=dCTyCLgGiipPvRSjArEEDVJGZvVmdvqZwReMm/yrA2POtCpLmlDe3Ifbb7dhT6elH6 na5W7fymxNUEB2FubWkd47O3s2HQYvvfyJyi0haxJdabZjz/yR5jOrO6k0E2/T0nlaQq uUsfKeSI27vxhZynXZG7lNPUZGhFhbOfKzXiQ= MIME-Version: 1.0 Received: by 10.231.61.198 with SMTP id u6mr2985544ibh.160.1305892433818; Fri, 20 May 2011 04:53:53 -0700 (PDT) Received: by 10.231.25.80 with HTTP; Fri, 20 May 2011 04:53:53 -0700 (PDT) In-Reply-To: References: Date: Fri, 20 May 2011 07:53:53 -0400 Message-ID: Subject: Re: pg_archivecleanup with multiple slaves From: Tim To: Ben Lancaster Cc: pgsql-admin@postgresql.org Content-Type: multipart/alternative; boundary=0015177411a8a1f69904a3b3c624 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.897 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/125 X-Sequence-Number: 37562 --0015177411a8a1f69904a3b3c624 Content-Type: text/plain; charset=ISO-8859-1 I think you are using Log-Shipping not Streaming-Replication http://www.postgresql.org/docs/9.0/static/different-replication-solutions.html I would just make 2 copies of the WAL file one for each slave in different folders. That way if one slave is offline for a period of time it can catch up when it comes back online. On Fri, May 20, 2011 at 6:59 AM, Ben Lancaster wrote: > Hi, > > First post, forgive me if this is better suited to pgsql-general. > > I've got streaming replication set up with two slave servers (PostgreSQL > 9.0 on Ubuntu 10.04 LTS). The master pushes the WAL to an NFS export, which > is in turn mounted on and picked up by the two slaves. > > The problem I have is that pg_archivecleanup (running on one of the slaves) > was removing WAL logs before the other slave had picked up the changes, thus > breaking replication for the second slave. As an interim fix, I simply > disabled the automatic cleanup and figured I'd worry about it later. > > Well, later is now and I'm running out of HDD space. So, what's the best > (or perhaps, correct) way to handle cleaning up WAL archives when there's > more than one slave? My first thought was prefixing the pg_archivecleanup > call in recovery.conf's archive_cleanup_command with a "sleep" of a few > seconds to allow both slaves to pick up changes before WAL files are cleaned > up, but I'm afraid I'll end up with some weird race conditions, with loads > of sleeping processes waiting to cleanup WAL files that have previously been > cleaned up by a recently awoken process. > > Thanks in advance, > > Ben > > > -- > Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-admin > --0015177411a8a1f69904a3b3c624 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I think you are using Log-Shipping not Streaming-Replication
http://www.postgresql.org/docs/9.0/static/different-replication-soluti= ons.html

I would just make 2 copies of the WAL file one for each slave in differ= ent folders.
That way if one slave is offline for a period of time it ca= n catch up when it comes back online.

On = Fri, May 20, 2011 at 6:59 AM, Ben Lancaster <benlancaster@holler.co.uk> wrote:
Hi,

First post, forgive me if this is better suited to pgsql-general.

I've got streaming replication set up with two slave servers (PostgreSQ= L 9.0 on Ubuntu 10.04 LTS). The master pushes the WAL to an NFS export, whi= ch is in turn mounted on and picked up by the two slaves.

The problem I have is that pg_archivecleanup (running on one of the slaves)= was removing WAL logs before the other slave had picked up the changes, th= us breaking replication for the second slave. As an interim fix, I simply d= isabled the automatic cleanup and figured I'd worry about it later.

Well, later is now and I'm running out of HDD space. So, what's the= best (or perhaps, correct) way to handle cleaning up WAL archives when the= re's more than one slave? My first thought was prefixing the pg_archive= cleanup call in recovery.conf's archive_cleanup_command with a "sl= eep" of a few seconds to allow both slaves to pick up changes before W= AL files are cleaned up, but I'm afraid I'll end up with some weird= race conditions, with loads of sleeping processes waiting to cleanup WAL f= iles that have previously been cleaned up by a recently awoken process.

Thanks in advance,

Ben


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

--0015177411a8a1f69904a3b3c624--