Deleting unwanted wal files

Started by krish050591over 8 years ago4 messagesgeneral
Jump to latest
#1krish050591
krish050591@gmail.com

Hi, if i'm using pg_basebackup utility for taking my database backup and also
enabled wal level archiving, how will i detect the unwanted wal files and
how will it delete them ?

--
View this message in context: http://www.postgresql-archive.org/Deleting-unwanted-wal-files-tp5978815.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Michael Paquier
michael@paquier.xyz
In reply to: krish050591 (#1)
Re: Deleting unwanted wal files

On Thu, Aug 17, 2017 at 8:06 PM, krish050591 <krish050591@gmail.com> wrote:

Hi, if i'm using pg_basebackup utility for taking my database backup and also
enabled wal level archiving, how will i detect the unwanted wal files and
how will it delete them ?

Have you heard of pg_archivecleanup? Documentation is here:
https://www.postgresql.org/docs/devel/static/pgarchivecleanup.html
If a single archive is not cross-used among multiple standbys, you
could use it with archive_cleanup_command is recovery.conf to remove
unneeded WAL segments.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3krish050591
krish050591@gmail.com
In reply to: Michael Paquier (#2)
Re: Deleting unwanted wal files

Thanks for your reply, but will pg_basebackup generate a .backup file when
scheduled in cron job so that i can give that as input to
pg_archivecleanup. Also if i give archive_cleanup_command in recovery.conf
will it check the presence of recovery.conf file automatically and execute
the command from that file ?

On 17 Aug 2017 8:01 p.m., "Michael Paquier" <michael.paquier@gmail.com>
wrote:

Show quoted text

On Thu, Aug 17, 2017 at 8:06 PM, krish050591 <krish050591@gmail.com>
wrote:

Hi, if i'm using pg_basebackup utility for taking my database backup and

also

enabled wal level archiving, how will i detect the unwanted wal files and
how will it delete them ?

Have you heard of pg_archivecleanup? Documentation is here:
https://www.postgresql.org/docs/devel/static/pgarchivecleanup.html
If a single archive is not cross-used among multiple standbys, you
could use it with archive_cleanup_command is recovery.conf to remove
unneeded WAL segments.
--
Michael

#4Michael Paquier
michael@paquier.xyz
In reply to: krish050591 (#3)
Re: Deleting unwanted wal files

On Fri, Aug 18, 2017 at 12:43 AM, krishna chaitanya
<krish050591@gmail.com> wrote:

Thanks for your reply,

Please do not top-post, this is not the style of this mailing list.

but will pg_basebackup generate a .backup file when
scheduled in cron job so that i can give that as input to pg_archivecleanup.

Yes.

Also if i give archive_cleanup_command in recovery.conf will it check the
presence of recovery.conf file automatically and execute the command from
that file ?

You can feed a backup history file name to pg_archivecleanup, it will
then reuse the prefix of this file name. archive_cleanup_command is
part of recovery.conf, which gets loaded by the server at the
beginning of recovery by the startup process, so the command will get
executed continuously on a standby.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general