smith
smith

Reputation: 113

postgresql streaming replication - Master Server keeps all the archives and this is filling up my HD

Is there a way to run cleanups on Master Server for these archive files that are older and are not needed for the slave server for streaming replication?

Upvotes: 0

Views: 476

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246013

You can use the recovery parameter archive_cleanup_command together with the pg_archivecleanup command:

archive_cleanup_command = 'pg_archivecleanup /var/lib/postgresql/pg_log_archive/main %r'

That command assumes that the WAL archives are accessible in /mnt/server/archivedir on the standby server.

Note that for PostgreSQL versions older than v12, this has to be specified in recovery.conf.

If you don't have an easy way to access the WAL archives from the standby, you could use an NFS mount.

Upvotes: 2

Related Questions