Postgresql – pg_archivecleanup not found Postgres 9.1, even though it is installed

postgresqlreplicationstreaming

I have streaming replication setup on 2 Postgres 9.1 servers. Everything is ok apart from the archivecleanup. In the logs it says:

sh: 1: pg_archivecleanup: not found
2013-11-19 09:17:37 GMT WARNING:  archive_cleanup_command "pg_archivecleanup /var/lib   /postgresql/9.1/wals/ %r": return code 32512

I can see pg_archivecleanup is in /usr/lib/postgresql/9.1/bin.
Why can Postgres not see this?

Best Answer

If you're using Postgres 9.1's streaming replication why do you need archive cleanups?

I suggest the following alternative to your entire situation:

  1. Set your log segment retention to something sensible.
    A good starting point for "sensible" would be to set wal_keep_segments to keep roughly the same number of log segments as you were previously keeping in the master's archive.
    You can adjust from there as needed.

  2. Turn off archive_mode on your servers.
    Streaming replication obviates the need for this, and (1) above means you'll have plenty of log segments to restore from if you need to.

  3. Get rid of the pg_archivecleanup command in recovery.conf on your slaves.
    (Because you simply don't need it with streaming replication.)


Depending on your environment you may elect to leave out (2) (if you have a real need for the WAL archive other than replication), but in most cases you only had that archive around so you could do replication/log-shipping anyway. Save yourself the disk I/O.

Related Topic