From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: WAL archive cleanup om master |
Date: | 2014-01-06 15:16:25 |
Message-ID: | 52CAC8C9.9040208@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 01/06/2014 03:18 AM, Martijn van Oosterhout wrote:
> Hoi,
>
> I've setup a up WAL shipping configuration as described in the wiki. On
> the master I have:
>
> archive_mode = on
> archive_command = 'cp %p /path_to/archive/%f'
>
> and on the slave in the recovery.conf I have:
>
> archive_cleanup_command = 'pg_archivecleanup /path/to/archive/ %r'
> restore_command = 'cp /path/to/archive/%f %p'
>
> In between the two machines I have an rsync process copying the files
> from the master to the slave.
>
> My problem is, that the archive_cleanup_command on the slave is
> clearing old WAL files, which the rsync on the master just copies again
> because they are still on the master.
>
> I can make a script on the master that deletes files older than an
> hour, but that will break horribly if the copying breaks for an hour.
>
> Is there a smarter way to do this, like having rsync not copy stuff
> already copied once?
So the rsync and archive_command combination is a belt and suspenders thing?
As to rsync, if I understand what you want you might take a look at
--existing:
http://linux.die.net/man/1/rsync
--existing, --ignore-non-existing
This tells rsync to skip creating files (including directories)
that do not exist yet on the destination. If this option is combined
with the --ignore-existing option, no files will be updated (which can
be useful if all you want to do is delete extraneous files).
>
> Thanks in advance,
>
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-01-06 15:32:05 | Re: How to check for pending CancelRequest from C/C++ function |
Previous Message | Stephen Woodbridge | 2014-01-06 15:13:46 | How to check for pending CancelRequest from C/C++ function |