AWSnycast
AWSnycast copied to clipboard
I would like to run a script on failover
Per discussion with @bobtfish on IRC, I'm exploring the use of AWSnycast for a high-availability Postgres setup. If the primary goes down and the route switches to the next-best standby, I would need to be able to run a script that does pg_ctl promote on that standby to enable r/w database connections there. Is that possible?
Not currently possible, but pretty easy to add hooks for.
Sorry for the delay - development stalled for a couple of months over Xmas as I moved house / city etc :)
I'm planning / hoping to add initial support for this this weekend :)
Ok, I've added the ability to call scripts on healthcheck pass / fail, but (from re-reading the above, and our conversation), I'm guessing that you want hooks specifically when routes get changed.
I'm thinking:
RunBeforeAddRoute RunAfterAddRoute RunBeforeDeleteRoute RunAfterDeleteRoute
would be the full set of hooks someone could want.
My remaining concern / thing I'm not sure about is if differentiating between Add / Replace could be useful or not, however I'm going to go with the above and see how that plays out in the code.