From: Stephen Frost <sfrost@snowman.net>
To: Vikas Sharma <shavikas@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_receivexlog or archive_command
Date: Wed, 2 Oct 2019 02:16:51 -0400
Message-ID: <20191002061651.GD6962@tamriel.snowman.net> (raw)
In-Reply-To: <CAN6gwKwx865jv0fqc7SfwsG3utPhSoFF_tFaptcoDUW+T0uP8w@mail.gmail.com>
References: <CAN6gwKwx865jv0fqc7SfwsG3utPhSoFF_tFaptcoDUW+T0uP8w@mail.gmail.com>
Greetings,
* Vikas Sharma (shavikas@gmail.com) wrote:
> I am wondering which one is the best way to archive the xlogs for Backup
> and Recovery - pg_receivexlog or archive_command.
>
> pg_receivexlog seems best suited because the copied/archived file is
> streamed as it is being written to in xlog while archive_command only
> copies when the WAL is fully written to.
This really ends up depending on what your WAL volume is. As mentioned,
you really don't want to write your own utility for archive_command,
since you really want to make sure that the WAL has actually been
archived and sync'd- so definitely use an existing tool which does that
for you. The downside of pg_receivewal when it comes to high WAL volume
is that a single-threaded process just simply can't keep up, while
something being called from archive_command can be parallelized.
Perhaps, down the road, there'll be a tool that could parallelize
streaming of WAL also, though it would be pretty tricky to get right,
and if you're doing that much WAL, is it really an issue that it's
already chunked up nicely for archive_command..?
Note that there is also archive_timeout which you can set, to make sure
that you don't go too long with writes on the primary that haven't been
sent to the archive and stored. If your transations are particularly
valuable, then having a synchronous standby setup (likely with two
replicas in a quorum-based sync setup) is probably the direction to
go in, so you can have a highly available environment. Anything that's
async will mean you have a good chance of having some data loss if
things go wrong (even with pg_receivewal..).
Thanks,
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
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 using the --to and --cc options:
reply via email
To: pgsql-general@postgresql.org
Cc: sfrost@snowman.net, shavikas@gmail.com, pgsql-general@lists.postgresql.org
Subject: Re: pg_receivexlog or archive_command
In-Reply-To: <20191002061651.GD6962@tamriel.snowman.net>
* 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