0

I have Postgres installed on windows 10. I have master-slave replication ( 1 pc is master and 2 other pc are slaves). I have archive logs saved on a file on master pc and slaves are connected to that file. That file has become quite big and i need to know how to remove log files with pg_archive cleaner. I also have automatic backup jobs on every day. 😊

1
  • You can use pg_archivecleanup to remove all archived segments older than a certain one. – Laurenz Albe May 5 at 16:49
0

pg_archivecleanup won't work automatically with 2 replicas, as it doesn't coordinate between them to reach an agreement. You would have to manually decide up to what point you can remove them by determining which replica has the older restartpoint. You could then feed that oldest restartpoint to pg_archivecleanup, but I don't see the point, if you have to decide manually what to use, why not just remove them manually as well?

You could use replication slots, and do away with the archive. Then it will automatically keep files in pg_wal and remove them once they are no longer needed by any replica. This does mean pg_wal might need to have somewhat larger capacity than it currently does, if the replicas ever get way behind. (But then you don't have to reserve capacity for the archive anymore)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.