2

Assume we have

  1. master server (archive_command = '')
  2. hot_standby server (archive_command = ':')
  3. pg_receivewal server (from master slot)

What would be the correct procedure to promote hot_standby server to master, change archive_command to '' and change pg_receivewal slot?

My concern is a duplicate wal file mess between all 3 servers if done incorrectly.

2
  • Neither one of those archive_commands does anything, so how can they make a mess? – jjanes Oct 31 '20 at 15:48
  • Yes so the mess is that the master would maybe have wal files in pg_wal that pg_receivewal still needs and may or may not be on the standby server – Gert Cuykens Nov 1 '20 at 2:00
1

It's not normally recommended to promote the hot standby but have you read this article on it?

https://help.theatremanager.com/book/export/html/3679

3
  • No I didn't know, makes me wonder what else I'm missing. So if I just do that can I change the archive command before failover without making a wal mess? – Gert Cuykens Oct 31 '20 at 4:02
  • @Gert Cuykens, honestly, this falls outside my scope of knowledge a bit, so I'd recommend attempting the promotion in a test environment first if possible since it's normally not recommended to do. If you can verify everything is ok in the dev environment and have the process down, then you can feel more confident attempting in your other server. I'm going to do some more research and will update you if I find more concrete information for your specific use case. – J.D. Oct 31 '20 at 12:11
  • Maybe disabling archive_mode / archive_command all together is the way forward and just let the slot / pg_receivewal be in charge. As far as I can tell doing that it works even when documentation says it shouldn't but then again I don't know if you then need to clean up pg_wal manually using pg_archivecleanup. And even more important is it actually working or was I just lucky it didn't corrupt. – Gert Cuykens Nov 1 '20 at 1:54

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.