Re: WAL shipping to two machines (PITR)

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: WAL shipping to two machines (PITR)
Date: 2009-11-07 15:21:14
Message-ID: 20091107152114.GZ5407@samason.me.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Nov 07, 2009 at 08:10:23AM -0500, Geoffrey wrote:
> We now want to add a second PITR machine that is in a remote location.
> The question is, what is the best solution for such an effort? We've
> considered shipping the wal files to both locations, but the concern is
> that if one fails, how do we maintain the other?

Where do you put your trust in machine availability, is the local one
going to be up as much as the database and the worry about the remote
machine mainly about the reliability of the network?

If that's the case, how about just copying to the local machine and then
have it copy over to the remote one as needed. Could you just use the
following:

archive_command = 'ssh pgbackup(at)onsite archivewal %f < %p'

and make the "archivewal" script do something like the following:

#!/bin/sh
f="/var/pgbackup/$1"
[ -f "$f" ] && exit 1
set -o noclobber # just in case
cat > "$f"
scp "$f" pgbackup(at)offsite:/var/pgbackup/ \
< /dev/null >> offsitelog 2>&1 &

I.e. write stdin to the file specified and then try and scp it over to
the offsite location in the background. You could have a cron job to
mop up when the network goes down and files don't copy.

--
Sam http://samason.me.uk/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-11-07 16:23:55 slony issues.
Previous Message Sam Mason 2009-11-07 14:33:08 Re: alter table is taking a long time