pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rui DeSousa <rui.desousa@icloud.com>
To: scott ribe <scott_ribe@elevated-dev.com>
Cc: Nagy László Zsolt <gandalf@shopzeus.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: Reliable WAL file shipping over unreliable network
Date: Wed, 28 Feb 2018 12:05:25 -0500
Message-ID: <CF30D15A-BD42-42A7-9AD3-BB69AF9E8047@icloud.com> (raw)
In-Reply-To: <BA4A1866-95B0-49C6-8CD1-3D1B60A7837E@elevated-dev.com>
References: <dd116172-3ddf-ee56-57f3-6e18d49abf8e@shopzeus.com>
	<400AC9CD-1E43-422C-A689-70BDBAFF231E@elevated-dev.com>
	<ee3ae4be-ab24-8443-82c1-95bcd4f86a63@shopzeus.com>
	<debd4205-e27a-cd9d-9169-6748e65083a2@shopzeus.com>
	<BA4A1866-95B0-49C6-8CD1-3D1B60A7837E@elevated-dev.com>


Just use "-ac”;  you want -c option to ensure no data corruption during the transfer.  Do not delete the file; let Postgres manage that.

Here is a snippet from I script I use for archiving.  You also want to make your script returns failure or success correctly.  

# SSH Command and options
SSH_CMD="ssh -o ServerAliveInterval=20 $ARCH_SERVER"
STS=3

OUTPUT=$(rsync -ac --rsync-path="mkdir -p $ARCH_DIR && rsync" $XLOGFILE $ARCH_SERVER:$ARCH_DIR/$WALFILE)
if [ $? == 0 ]; then 
   STS=0
fi

exit $STS

> On Feb 28, 2018, at 11:38 AM, scott ribe <scott_ribe@elevated-dev.com> wrote:
> 
> On Feb 28, 2018, at 8:46 AM, Nagy László Zsolt <gandalf@shopzeus.com> wrote:
>> 
>> Another problem with rsync might be that it does not know if a WAL file
>> on the source side is growing (e.g. being written) and it might start
>> copy that before it is fully flushed to disk. I see this as a big
>> problem, but I don't have experience.
> 
> You use rsync in the archive command, not by itself. Postgres does not try to copy the file until it is ready.
> 
>> E.g. move the file into the archive dir only after it has been fully
>> copied to the destination volume. But then we still have the problem of
>> partially written files on the slave side.
> 
> No, you do not have that problem at all.
> 
> Given an unreliable network, you probably do want to use --partial
> 
> 
> --
> Scott Ribe
> https://www.linkedin.com/in/scottribe/
> (303) 722-0567
> 
> 

view thread (59+ messages)  latest in thread

Message-ID: <CF30D15A-BD42-42A7-9AD3-BB69AF9E8047@icloud.com>
Permalink:  ../CF30D15A-BD42-42A7-9AD3-BB69AF9E8047@icloud.com/
Also on:    postgresql.org/message-id/CF30D15A-BD42-42A7-9AD3-BB69AF9E8047@icloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: rui.desousa@icloud.com, scott_ribe@elevated-dev.com, gandalf@shopzeus.com
  Subject: Re: Reliable WAL file shipping over unreliable network
  In-Reply-To: <CF30D15A-BD42-42A7-9AD3-BB69AF9E8047@icloud.com>
  References: <dd116172-3ddf-ee56-57f3-6e18d49abf8e@shopzeus.com> <400AC9CD-1E43-422C-A689-70BDBAFF231E@elevated-dev.com> <ee3ae4be-ab24-8443-82c1-95bcd4f86a63@shopzeus.com> <debd4205-e27a-cd9d-9169-6748e65083a2@shopzeus.com> <BA4A1866-95B0-49C6-8CD1-3D1B60A7837E@elevated-dev.com> <CF30D15A-BD42-42A7-9AD3-BB69AF9E8047@icloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox