Re: archive_command options? - Mailing list pgsql-admin

From Keith Fiske
Subject Re: archive_command options?
Date
Msg-id CAODZiv6M6up6JemG7EMV0F8WfOMO4Op+SbADxdkfrYRJ8LX-Bw@mail.gmail.com
Whole thread Raw
In response to archive_command options?  (LEROY TENNISON <leroy_tennison@prodigy.net>)
List pgsql-admin


On Wed, Apr 3, 2019 at 4:18 PM LEROY TENNISON <leroy_tennison@prodigy.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.


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

pgsql-admin by date:

Previous
From: Prince Pathria
Date:
Subject: Re: Configuration of django with master slave replication Postgres
Next
From: Peter Eisentraut
Date:
Subject: Re: archive_command options?