Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCDVr-00089c-S1 for pgsql-admin@arkaria.postgresql.org; Wed, 21 Aug 2013 18:52:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VCDVq-0006TP-IW for pgsql-admin@arkaria.postgresql.org; Wed, 21 Aug 2013 18:52:10 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCDVp-0006TI-Ag for pgsql-admin@postgresql.org; Wed, 21 Aug 2013 18:52:09 +0000 Received: from roobarb.crazydogs.org ([46.235.224.144] helo=roobarb.jellybean.co.uk) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCDVl-0005Tt-1H for pgsql-admin@postgresql.org; Wed, 21 Aug 2013 18:52:08 +0000 Received: from rp by roobarb.jellybean.co.uk with local (Exim 4.69) (envelope-from ) id 1VCDVj-0008Li-AR; Wed, 21 Aug 2013 19:52:03 +0100 Date: Wed, 21 Aug 2013 19:52:03 +0100 From: Richard Poole To: Sergey Arlashin Cc: "pgsql-admin@postgresql.org" Subject: Re: Standalone Hot Backups Message-ID: <20130821185203.GF13732@roobarb.crazydogs.org> References: <1506B870-FE7D-4A13-B7BF-700F33BE9FC6@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1506B870-FE7D-4A13-B7BF-700F33BE9FC6@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: rp@guests.deus.net X-SA-Exim-Scanned: No (on roobarb.jellybean.co.uk); SAEximRunCond expanded to false X-Pg-Spam-Score: 0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org On Wed, Aug 21, 2013 at 09:35:23PM +0400, Sergey Arlashin wrote: > Hi! > I'm reading this article http://www.postgresql.org/docs/current/static/continuous-archiving.htm > > In section 'Making a Base Backup Using the Low Level API' is said that once one has WAL archiving set up it is ok to omit pg_xlog folder from the backup dump: > > > "You can, however, omit from the backup dump the files within the cluster's pg_xlog/ subdirectory. This slight adjustment is worthwhile because it reduces the risk of mistakes when restoring. This is easy to arrange if pg_xlog/ is a symbolic link pointing to someplace outside the cluster directory, which is a common setup anyway for performance reasons. You might also want to exclude postmaster.pid and postmaster.opts, which record information about the running postmaster, not about the postmaster which will eventually use this backup. (These files can confuse pg_ctl.)" > > But in section related to making standalone hot backups there is no information about it. > > There is only the following set of commands: > > touch /var/lib/pgsql/backup_in_progress > psql -c "select pg_start_backup('hot_backup');" > tar -cf /var/lib/pgsql/backup.tar /var/lib/pgsql/data/ > psql -c "select pg_stop_backup();" > rm /var/lib/pgsql/backup_in_progress > tar -rf /var/lib/pgsql/backup.tar /var/lib/pgsql/archive/ > > I only can see that the backup folder is being archived with pg_xlog. > > > So, the question is - is it ok to omit pg_xlog folder from backup dump while making standalone hot backups or not ? In order to use a base backup as a standalone hot backup, you need the WAL files which were generated between the time that you started the backup and the time it finished. These files are generated in the pg_xlog directory and are automatically removed when no longer required. In the first case, you will have them from your archive and therefore you don't need the pg_xlog directory. In the second case, it's assumed that you've not got archiving set up and the paragraph before the one you quoted describes the use of the file /var/lib/pgsql/backup_in_progress to turn archiving on temporarily; the last command in the sequence adds the files from the temporary archive to the base backup in the tar file. So you don't actually need the pg_xlog directory and it would be OK for the base backup to have excluded it. Short answer: it is OK to omit pg_xlog, because as part of a standalone hot backup you will always have the WAL files from another source. Richard -- Richard Poole http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin