Re: Archive Command Configuration

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Pallav Kalva <pkalva(at)livedatagroup(dot)com>
Cc: Steve Crawford <scrawford(at)pinpointresearch(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Archive Command Configuration
Date: 2006-03-24 19:03:27
Message-ID: 20060324190327.GX90527@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Thomas F. O'Connell 2006-03-24 20:14:48 Continuous On-line Backups
Previous Message Pallav Kalva 2006-03-24 17:12:54 Re: Archive Command Configuration