Re: archive_command options?

From: Keith Fiske <keith(dot)fiske(at)crunchydata(dot)com>
To: LEROY TENNISON <leroy_tennison(at)prodigy(dot)net>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: archive_command options?
Date: 2019-04-04 13:27:02
Message-ID: CAODZiv6M6up6JemG7EMV0F8WfOMO4Op+SbADxdkfrYRJ8LX-Bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Apr 3, 2019 at 4:18 PM LEROY TENNISON <leroy_tennison(at)prodigy(dot)net>
wrote:

> Postgresql documentation lists the following as an archive command for log
> shipping:
>
> archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p
> /mnt/server/archivedir/%f'
>
> The problem is that it is very fragile. If anything breaks the copy
> (either system failing, network issues) then log shipping stops because the
> file exists in some intermediate state. The result is that logs build up
> on the source system filling disk space. I've had to deal with a few of
> these this week, in two cases the file system was 98% full. Is there a
> reason rsync isn't used? It has the ability to restart interrupted
> transfers. I don't want to use it only to find out i got myself into
> another predicament. Any other less-fragile options? Thanks for the help.
>

It is definitely recommended to use something more reliable the cp command.
The docs are just an example that your own command can be used for the
archive_command.

I'd recommend one of the more well maintained backup tools out there such
as pgbackrest. They have very robust archive & restore command options that
are made to handle failure situations much more cleanly. They also provide
good automated retention options.

https://pgbackrest.org/

--
Keith Fiske
Senior Database Engineer
Crunchy Data - http://crunchydata.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Eisentraut 2019-04-04 21:14:16 Re: archive_command options?
Previous Message Prince Pathria 2019-04-04 13:06:36 Re: Configuration of django with master slave replication Postgres