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 E5FAE9DC846 for ; Fri, 24 Mar 2006 07:42:22 -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 86555-05 for ; Fri, 24 Mar 2006 07:42:25 -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 7924B9DC845 for ; Fri, 24 Mar 2006 07:42:20 -0400 (AST) Received: by noel.decibel.org (Postfix, from userid 1001) id 2B1E856431; Fri, 24 Mar 2006 05:42:23 -0600 (CST) Received: (hashcash-sendmail, from uid 1001); Fri, 24 Mar 2006 05:42:22 -0600 Date: Fri, 24 Mar 2006 05:42:22 -0600 From: "Jim C. Nasby" To: Steve Crawford Cc: pgsql-admin@postgresql.org Subject: Re: Archive Command Configuration Message-ID: <20060324114222.GV90527@pervasive.com> References: <4422FD80.5080009@livedatagroup.com> <442304F9.4090708@pinpointresearch.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <442304F9.4090708@pinpointresearch.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:scrawford@pinpointresearch.com::mEiqLjSIcu/UYqqa:0000000 0000000000000000000000004fPc X-Hashcash: 1:20:060324:pgsql-admin@postgresql.org::zPqJQS8zUiYde3Wd:00000000000 0000000000000000000000006dkk 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/233 X-Sequence-Number: 20990 On Thu, Mar 23, 2006 at 12:28:41PM -0800, Steve Crawford wrote: > >...I have a > >cron job from the production database that runs every 5-10min to check > >if there are any new archive logs and copy new archive logs to the > >remote stand by failover machine. > > > >The problem with this scenario is that there might be a possibility that > >I might scp a partially filled archive log over to the remote machine on > >a heavily updated databases with batch jobs runnings most of the time > >like ours. > > > > So, inorder to over come this we want to change the archive_command to > > > >archive_command = 'cp %p /archives-temp/%f && mv /archives-temp/%f > >/archives/%f' > >( I could do remote copy also with the command but I dont want to go > >that route because of network problems. ) > > > >.... > > > > My question is there any problem in using this approach ? will I run > >into problems in the future ? are there any other better ways of solving > >this problem ? > > Looks like it should work but have you considered using rsync instead? > If the file grows from one pass to the next, rsync will send the > differences. rsync does nothing to address the race condition issue, though. If you fire up an rsync and the cp takes too long, you'll end up syncing a partially written WAL file, which could potentially be bad. BTW, there's also now a project on pgFoundry for using PITR to keep a warm-backup: http://pgfoundry.org/projects/pgpitrha/ -- 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