Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9VWh-00012T-DU for pgsql-general@arkaria.postgresql.org; Mon, 29 Jun 2015 09:38:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z9VWg-00068S-3A for pgsql-general@arkaria.postgresql.org; Mon, 29 Jun 2015 09:38:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9VWO-0005nD-H6 for pgsql-general@postgresql.org; Mon, 29 Jun 2015 09:38:36 +0000 Received: from ks392306.kimsufi.com ([176.31.105.177] helo=cathode.atosc.org) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z9VWK-0005M4-Ih for pgsql-general@postgresql.org; Mon, 29 Jun 2015 09:38:35 +0000 Received: from [192.168.1.16] (bre70-2-78-243-5-30.fbx.proxad.net [78.243.5.30]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by cathode.atosc.org (Postfix) with ESMTPSA id 8C98B6016E; Mon, 29 Jun 2015 11:37:22 +0200 (CEST) Message-ID: <55911233.7030902@postgres.fr> Date: Mon, 29 Jun 2015 11:38:59 +0200 From: =?UTF-8?B?U3TDqXBoYW5lIFNjaGlsZGtuZWNodA==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: pgsql-general@postgresql.org Subject: Re: pg_xlog on a hot_stanby slave References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) 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 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. -- Stéphane Schildknecht Contact régional PostgreSQL pour l'Europe francophone Loxodata - Conseil, expertise et formations 06.17.11.37.42 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general