Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Is there a way to detect if the master PostgreSQL (9.3) server becomes unresponsive, and if so, create the trigger file (that is specified in recovery.conf) that initiates the failover process?

Or more specifically, is there some kind of ping or keepalive command that you can use from the slave to see if the master is responding? If so, this can probably be implemented with a shell script rather easily. I have not yet found a command that does something similar to this. Any help is appreciated, thank you.

share|improve this question

migrated from stackoverflow.com Jul 2 at 10:03

This question came from our site for professional and enthusiast programmers.

    
postgresql.org/docs/current/static/app-pg-isready.html You might also want to have a look at repmgr which also supports automatic failover –  a_horse_with_no_name Jul 1 at 22:31
    
Thank you, I will look into it! –  Jotunn Jul 2 at 1:04

1 Answer 1

up vote 2 down vote accepted

repmgr 2.0 supports automatic failover.

However, I strongly advise you not to use automatic failover. It's generally a much better idea to use manually triggered automated failover, where the failover process is scripted/automated, but a human has to say "Yup, master's dead, do it".

If you do use automatic failover you need to make it a routine part of your operations, where you test it regularly. Otherwise it will bite you when you least expect it and can least afford it.

It is also vital that you consider fencing/STONITH as part of your failover solution, to prevent two diverging masters.

share|improve this answer
    
Gotcha, thank you for the advice. –  Jotunn Jul 2 at 1:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.