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 D46979DC804 for ; Fri, 24 Mar 2006 15:03:32 -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 16207-02 for ; Fri, 24 Mar 2006 15:03:32 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id E5D559DC84D for ; Fri, 24 Mar 2006 15:03:29 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 579A356427; Fri, 24 Mar 2006 13:03:29 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 13:03:27 -0600 Date: Fri, 24 Mar 2006 13:03:27 -0600 From: "Jim C. Nasby" To: Pallav Kalva Cc: Steve Crawford , pgsql-admin@postgresql.org Subject: Re: Archive Command Configuration Message-ID: <20060324190327.GX90527@pervasive.com> References: <4422FD80.5080009@livedatagroup.com> <442304F9.4090708@pinpointresearch.com> <20060324114222.GV90527@pervasive.com> <442412BD.6090706@livedatagroup.com> <20060324164530.GT90527@pervasive.com> <44242896.1020701@livedatagroup.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44242896.1020701@livedatagroup.com> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060324:pkalva@livedatagroup.com::8Rt+0zC/JPluYZyJ:0000000000000 000000000000000000000000Cxhj X-Hashcash: 1:20:060324:scrawford@pinpointresearch.com::FOBcmbnnL/KNcNnB:0000000 00000000000000000000000062KW X-Hashcash: 1:20:060324:pgsql-admin@postgresql.org::+pHiyRJL4BGLclwr:00000000000 00000000000000000000000028ZG X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.108 required=5 tests=[AWL=0.108] X-Spam-Score: 0.108 X-Spam-Level: X-Archive-Number: 200603/241 X-Sequence-Number: 20998 On Fri, Mar 24, 2006 at 12:12:54PM -0500, Pallav Kalva wrote: > 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') scp archives/%f remote-machine:temp ssh remote-machine mv temp/%f archive/%f That's the only way I can think of to ensure you don't get a partial logfile on the remote machine. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461