The documentation on PITR recovery that comes with pgpool is really incomplete, and downright misleading at points. It suggests keeping all the archive files on the master than then having a recovery_command that uses scp to copy from there to each standby. That's worthless. Each standby needs to have its own copy of the archive, or there's no real redundancy there. If the master fails in that situation, you have nothing useful. The archive_command on the master should distribute files to the standby systems instead. There is no need to save a copy of the archive on the master at all if you do that.
For cleaning up the archives on each standby, the poor recommendation for the recovery_command given there shouldn't be followed either. Instead pg_standby should be called as the recovery command. See the real documentation on Warm Standby Servers for more details. If you're using pg_standby, one of the things it should gets passed is the "%r" parameter, which is the information needed to remove old archive logs. Use pg_standby that way and it will clean up the archives for you.
The main non-trivial part here is writing an archive_command script that properly copies data to both standby servers. I don't have a good example to point at, but what you need to do is check for errors after each copy, and provide a success return code only if both copies happen.
No comments:
Post a Comment