X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 3F38D9DCA29 for ; Fri, 24 Mar 2006 13:12:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78989-08 for ; Fri, 24 Mar 2006 13:12:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.livedatagroup.com (unknown [64.139.144.2]) by postgresql.org (Postfix) with ESMTP id 33CEA9DCA03 for ; Fri, 24 Mar 2006 13:12:56 -0400 (AST) Received: from [192.168.2.126] (adsl-074-228-048-194.sip.bct.bellsouth.net [74.228.48.194]) by mail.livedatagroup.com (Postfix) with ESMTP id 7911855F99; Fri, 24 Mar 2006 12:12:55 -0500 (EST) Message-ID: <44242896.1020701@livedatagroup.com> Date: Fri, 24 Mar 2006 12:12:54 -0500 From: Pallav Kalva MIME-Version: 1.0 To: "Jim C. Nasby" Cc: Steve Crawford , pgsql-admin@postgresql.org Subject: Re: Archive Command Configuration References: <4422FD80.5080009@livedatagroup.com> <442304F9.4090708@pinpointresearch.com> <20060324114222.GV90527@pervasive.com> <442412BD.6090706@livedatagroup.com> <20060324164530.GT90527@pervasive.com> In-Reply-To: <20060324164530.GT90527@pervasive.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.08 required=5 tests=[AWL=0.080] X-Spam-Score: 0.08 X-Spam-Level: X-Archive-Number: 200603/240 X-Sequence-Number: 20997 Jim C. Nasby wrote: >On Fri, Mar 24, 2006 at 10:39:41AM -0500, Pallav Kalva wrote: > >> What do you think about this option ? If I just do scp from the >>/archives folder, I will be ok and wont copy any partial files at any >>time right ? >>archive_command = 'cp %p /archives-temp/%f && mv /archives-temp/%f >>/archives/%f' >> > >A simple scp leaves you vulnerable to a WAL file only being partially >copied if a backhoe hits at just the right moment. I believe that >wouldn't be an issue with rsync, since it won't put a file in place >until it's completely transfered. So if you want to use scp, I think >you'd need to scp to a temporary directory, and then do a final move. > Are you talking about scp to a temporary directory and move on a remote machine ? The idea with this archive command is to make postgres copy first to "archive-temp" directory and once the copy of the file is done completely then move it to "archives" directory on the source machine. My cronjob then does scp from the archives folder on source machine regularly to a remote location, this way it never does a scp on a partial file since files are movied only when it is completely copied. This way I will never scp a partial file and be sure that copy on the remote machine is a complete clean copy. (archive_command = 'cp %p /archives-temp/%f && mv /archives-temp/%f /archives/%f')