Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCDXK-0008Co-8O for pgsql-admin@arkaria.postgresql.org; Wed, 21 Aug 2013 18:53:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VCDXJ-00085H-Ji for pgsql-admin@arkaria.postgresql.org; Wed, 21 Aug 2013 18:53:41 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCDXG-000818-QE for pgsql-admin@postgresql.org; Wed, 21 Aug 2013 18:53:39 +0000 Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCDXC-0005Ui-SB for pgsql-admin@postgresql.org; Wed, 21 Aug 2013 18:53:37 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VCDX9-0002x0-6i for pgsql-admin@postgresql.org; Wed, 21 Aug 2013 20:53:31 +0200 Received: from p5081a8f0.dip0.t-ipconnect.de ([80.129.168.240]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Aug 2013 20:53:31 +0200 Received: from chris by p5081a8f0.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Aug 2013 20:53:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-admin@postgresql.org From: Christian Ullrich Subject: Re: Standalone Hot Backups Date: Wed, 21 Aug 2013 20:53:20 +0200 Lines: 55 Message-ID: <52150CA0.4070607@chrullrich.net> References: <1506B870-FE7D-4A13-B7BF-700F33BE9FC6@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p5081a8f0.dip0.t-ipconnect.de User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: <1506B870-FE7D-4A13-B7BF-700F33BE9FC6@gmail.com> X-Pg-Spam-Score: -2.0 (--) 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 * Sergey Arlashin wrote: > 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 > But in section related to making standalone hot backups there is no > information about it. > > There is only the following set of commands: [...] > 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 ? I'm not sure why the example does not exclude pg_xlog; IMHO it should. Perhaps the author of the example was using the setup mentioned in section 24.3.3, where pg_xlog is a symbolic link elsewhere? Restoring a backup created using that procedure will never need WAL files that are not in the (transient) archive directory. If your PostgreSQL version includes pg_basebackup, you should use it rather than the low-level API. If you include the -X option, you will get a backup that you can use as "standalone" as well as for point-in-time recovery, and if you use "plain" mode as well as -X, you can even use the backup directory as PGDATA directly: pg_basebackup will put the required WAL files into pg_xlog in the backup, so there is no need even for a recovery.conf file. Starting the database with that directory (and no recovery.conf) will only perform crash recovery. If you leave the -X option out, you can only do PITR, for which you need a WAL archive. It is interesting to follow the example's logic and see why it works: In the example, more WAL is archived than strictly necessary to restore the backup: Some WAL files will appear twice in the backup, once in pg_xlog, once in the "archive" directory. The first tar command will copy them (in an unusable intermediate state) from pg_xlog. pg_stop_backup() will archive all files used during the backup, and the second tar command will then append the "archive" to the backup. When restoring from the backup, you must have a recovery.conf file with a restore_command that will retrieve files from the (restored) archive. The important point is that PostgreSQL will prefer files from the archive to those in pg_xlog. Therefore, it will use the finished versions and ignore the files copied from pg_xlog. -- Christian -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin