5

I use streaming replication and PITR (WAL files) in my cluster, currently I have different versions of postgresql.conf for the master and the standby server.

The only difference in the files is the archive command, that points to a different directory.

for example, on master I have:

archive_command = 'cp %p /dbckp/server1master/%f'

And on the standby:

archive_command = 'cp %p /dbckp/server2master/%f'

I figure that if the standby is not generating any archives while on 'standby mode' I could use the same directory and have a single postgresql.conf.

4

In theory this should work. After all, the files should be identical. In practice I think it is scary and I wouldn't do it. I would worry about file locking contention, and also the fact that if I am archiving twice to two locations I get a full backup of the WAL's esp, if I send to different file servers. If one goes belly up at a bad time, I can still get logs off the other for PITR.

Keep in mind that if something goes wrong with this setup, you can lose PITR ability to roll forward beyond a certain point. Additionally if you set things up how they are now, you may be able to use file permissions and attributes to prevent overwriting existing parts of existing files which can be very helpful in backup assurance.

  • In the end I decided to keep 2 different locations for the files but unified the postgresql.conf by creating a softlink with the same name on both servers (but pointing to different locations). – Cleber Goncalves Feb 15 '13 at 8:58
2

Indeed, the standby does not archive wal segments, but you should always test for the existence of the segment about to be written and skip the write if it exists already.

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.