Reputation: 159
I am checking for a way to safely delete the archived xlog files(not the files under pg_xlog folder). I have postgresql streaming replication configured in my cluster. This is used by a fairly busy application and I have configured the "archive_timeout" variable to be 1 minute. I normally take a pg_basebackup overnight. Now, I need a way to safely delete the old archive files. Is there any recommended methods to do it?
Regards
Muhammed Roshan
Upvotes: 0
Views: 676
Reputation: 246013
You'll have to keep all WAL archives from the starting point of your oldest backup if you want to restore.
So the correct thing would be to tie WAL archive removal to the removal of base backups. When you remove an old base backup, delete all WAL archives up to the point in time when that backup was taken. That leaves you with a day's worth of unneeded WAL archives, but you are on the safe side.
Upvotes: 1