Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9Xqw-0007tQ-7Z for pgsql-general@arkaria.postgresql.org; Mon, 29 Jun 2015 12:07:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z9Xqv-0004u2-Gi for pgsql-general@arkaria.postgresql.org; Mon, 29 Jun 2015 12:07:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9Xnw-0002C2-8w for pgsql-general@postgresql.org; Mon, 29 Jun 2015 12:04:52 +0000 Received: from mail-wg0-x232.google.com ([2a00:1450:400c:c00::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z9Xns-0003xt-9C for pgsql-general@postgresql.org; Mon, 29 Jun 2015 12:04:51 +0000 Received: by wguu7 with SMTP id u7so139451706wgu.3 for ; Mon, 29 Jun 2015 05:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=oSL+iBlgX+6KBMY8+NkfrpqHR/rov1i8PdQyKJp7KRY=; b=eBzgenTlIoUJNIFBEYNq/FVkY1kYR9xRNDkpoKhXc+/ozosOpSxtA800kUXCH9ghpW OSlWDyAIlUJY4UQHui/NIAKA00aAFA4UYYORJSIcbc1tcX36q3PFMaghmXJkDOomGkIX 9Y6ytx3PVbEarAybDohBJf01Q3N0RcpozSgDau4TirAs8MbtUBiukMpBttITQ4GZG79n Ao9YJRtdqv0y2uzQEl/7erEZGkiM9t3IO6bPczueQiTWmIncEvrrJQ35G9WOKLSl/akv 5KoXHiH2x6GdvGgv4gWalOX8aKbiY6pjf4ujJdKFyPwHYKk9XQkejNzDZKBYxlsAHLdt YGKg== X-Received: by 10.180.99.2 with SMTP id em2mr21699830wib.59.1435579486349; Mon, 29 Jun 2015 05:04:46 -0700 (PDT) Received: from [10.3.255.188] (pir44-4-88-177-221-225.fbx.proxad.net. [88.177.221.225]) by mx.google.com with ESMTPSA id xa9sm59165862wjc.43.2015.06.29.05.04.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2015 05:04:45 -0700 (PDT) Subject: Re: pg_xlog on a hot_stanby slave To: pgsql-general@postgresql.org References: <55911233.7030902@postgres.fr> From: Xavier 12 Message-ID: <5591345B.8060404@gmail.com> Date: Mon, 29 Jun 2015 14:04:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <55911233.7030902@postgres.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 29/06/2015 11:38, Stéphane Schildknecht wrote: > On 16/06/2015 10:55, Xavier 12 wrote: >> Hi everyone, >> >> Questions about pg_xlogs again... >> I have two Postgresql 9.1 servers in a master/slave stream replication >> (hot_standby). >> >> Psql01 (master) is backuped with Barman and pg_xlogs is correctly >> purged (archive_command is used). >> >> Hower, Psql02 (slave) has a huge pg_xlog (951 files, 15G for 7 days >> only, it keeps growing up until disk space is full). I have found >> documentation and tutorials, mailing list, but I don't know what is >> suitable for a Slave. Leads I've found : >> >> - checkpoints >> - archive_command >> - archive_cleanup >> >> Master postgresq.conf : >> >> [...] >> wal_level = 'hot_standby' >> archive_mode = on >> archive_command = 'rsync -az /var/lib/postgresql/9.1/main/pg_xlog/%f >> barman@nas.lan:/data/pgbarman/psql01/incoming/%f' >> max_wal_senders = 5 >> wal_keep_segments = 64 >> autovacuum = on >> >> Slave postgresql.conf : >> >> [...] >> wal_level = minimal >> wal_keep_segments = 32 >> hot_standby = on >> >> Slave recovery.conf : >> >> standby_mode = 'on' >> primary_conninfo = 'host=10.0.0.1 port=5400 user=postgres' >> trigger_file = '/var/lib/postgresql/9.1/triggersql' >> restore_command='cp /var/lib/postgresql/9.1/wal_archive/%f "%p"' >> archive_cleanup_command = >> '/usr/lib/postgresql/9.1/bin/pg_archivecleanup >> /var/lib/postgresql/9.1/wal_archive/ %r' >> >> >> >> >> >> How can I reduce the number of WAL files on the hot_stanby slave ? >> >> Thanks >> >> Regards. >> >> Xavier C. >> >> > > I wonder why you are doing "cp" in your recovery.conf on the slave. > That is "quite" correct when the streaming can't get WAL from the master. But > cp is probably not the right tool. > > You also cp from the master archive directory, and are cleaning on that > directory as well. > > You don't clean up the standby xlog directory. And cp may copy incomplete WAL > files. > > The streaming replication can take care of your xlog clean up, until you > introduce WAL files by another mean (manual cp for instance). > > S. > cp because /var/lib/postgresq/9.1/wal_archive/ is a temporary directory. I use it to build the replication (copy wal with rsync from the master). The slave use it to start, then next wal are written ton /var/lib/postgresql/9.1/main/pg_xlog. Xavier C. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general