public inbox for [email protected]
help / color / mirror / Atom feedFrom: Laurenz Albe <[email protected]>
To: Justin Swanhart <[email protected]>
To: [email protected]
Subject: Re: Archive logging not cleaning up pg_wal directory
Date: Thu, 10 Apr 2025 14:48:00 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAJM9iN3w3UdA3q4_Xnw+Pg+Nnxe4OAUjLQ7EgLtPe36y4A0HDA@mail.gmail.com>
References: <CAJM9iN3w3UdA3q4_Xnw+Pg+Nnxe4OAUjLQ7EgLtPe36y4A0HDA@mail.gmail.com>
On Thu, 2025-04-10 at 08:28 -0400, Justin Swanhart wrote:
> I have the following in my postgresql.conf for archive logging:
> archive_command='test ! -f /var/lib/postgresql/prod_archive_logs/%f && cp %p /var/lib/postgresql/prod_archive_logs/%f'
>
> This command is properly copying the log files to my archive directory but they remain in the `pg_wal`
> directory after they are copied, consuming hundreds of gigs of space. Am I supposed to create a cron
> job to clean out the `pg_wal` directory periodically (keep only 1 day of logs I guess?)
>
> I tried to use mv:
> archive_command='test ! -f /var/lib/postgresql/prod_archive_logs/%f && mv %p /var/lib/postgresql/prod_archive_logs/%f'
>
> When I did this the archives were moved away to the archive directory but when I tried to set up
> replication the server could not find the archived log to replicate from so I changed it to "cp" and now have this problem.
>
> What am I missing?
Something else is blocking WAL removal:
https://www.cybertec-postgresql.com/en/why-does-my-pg_wal-keep-growing/
Since you mention replication, my money is on a stale replication slot.
Yours,
Laurenz Albe
view thread (3+ messages) latest in thread
reply
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: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Archive logging not cleaning up pg_wal directory
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox