There's more...
Don't think that our VIP takeover script is the only thing that is possible to accomplish here. In fact, we hope you don't even use our example at all. There are no safeguards that verify that the VIP no longer works after attempting to deactivate it; in fact, there aren't any other kinds of error checking at all. A real production-quality script would, for example, ensure that the VIP could be claimed before finally calling repmgr standby promote.
In fact, the script can do basically anything that doesn't affect the cluster until finally triggering the promotion step itself. Provided that each of these steps includes some kind of verification or exception handling, all it takes to abort the whole process is to either return ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access