AWSnycast icon indicating copy to clipboard operation
AWSnycast copied to clipboard

I would like to run a script on failover

Open amenonsen opened this issue 9 years ago • 2 comments

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?

amenonsen avatar Nov 24 '15 10:11 amenonsen

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 :)

bobtfish avatar Mar 05 '16 10:03 bobtfish

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.

bobtfish avatar Mar 05 '16 12:03 bobtfish