Reputation: 1
I have PostgreSQL streaming replication, and I want to delete the files in the archived folder that are getting bigger, does anyone know of a way to safely delete the old archived files. Is there any recommended method to do it?
Upvotes: 0
Views: 1264
Reputation: 21
You can use pg_archivecleanup to clean WAL file archives. The syntax is as follows:
archive_cleanup_command = 'pg_archivecleanup archivelocation %r'
Please go through the documentation below to further understand its functionality.
https://www.postgresql.org/docs/12/pgarchivecleanup.html
Upvotes: 1
Reputation: 44373
If you are using streaming, you don't need an archive at all. You can use a replication slot and turn off archiving.
If you are archiving for some reason other than merely to feed the replica, then we would need to know what that reason is before we can offer safe advice.
Upvotes: 0
Reputation: 247950
You can use pg_archivecleanup
. It is used in the replication configuration like this:
archive_cleanup_command = 'pg_archivecleanup archivelocation %r'
Then PostgreSQL will call this command and remove an archived WAL segment after it has been restored.
Upvotes: 0