I'm using Postgres 9.3 and I have a master database and a hot standby one that is following the master.
The operating system is CentOS 7.
I've changed the way of starting Posgres from SysV to systemd.
I've used the standard /usr/lib/systemd/system/postgresql-9.3.service
, and it's much more simplified than the old SysV script.
After the change, I've observed that it continues to work ok. The only downside is that the archives in the hot standby are never deleted. It is like the archive_cleanup_command
in recovery.conf
were ignored.
In the .service, Postgres is started in this way:
pg_ctl start -D ${PGDATA} -s -w -t 300
whereas in SysV in this other way:
postmaster -p $PGPORT -D $PGDATA
I think both of them are quite equivalent.
If I change back to SysV, then archives are not accumulated any more.
Why my archives aren't cleaned up with systemd?
Best Answer
The problem is that the PATH environment is different.
I had this line in
recovery.conf
:And Postgres doesn't find
pg_archivecleanup
and silently ignores it.Solution is to change the line to this: