Skip to content

Shell Script for PostgreSQL to promote Replication DB to Master DB when Master DB shut down

Notifications You must be signed in to change notification settings

ByBogon/Postgres_Shell_Script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

Postgres_Shell_Script

Centos7.7 / PostgreSQL 9.6

Shell Script for PostgreSQL to promote Replication DB to Master DB when Master DB shut down.

This shell script is for PostgreSQL Standby as Replication DB to be promoted to Master DB When you set them as Streaming replication not Log-Shipping.

It is health-checking Master DB with curl and deleting WAL Files that you are saving for back-up if Master DB is alive and your storage is up to specific number percentage.

and you should edit crontab in your linux, and user MUST be postgres. ex) crontab -u postgres -e

#every minute, your script will run.

* * * * * /your/script/path/

you can see the result of crontab in /var/spool/mail/root

ex) vim /var/spool/mail/root

If you want to apply your updated script for crontab, command "systemctl restart crond" will help you out.

About

Shell Script for PostgreSQL to promote Replication DB to Master DB when Master DB shut down

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages