Created
October 13, 2013 04:34
-
-
Save holly/6958223 to your computer and use it in GitHub Desktop.
pgpool failover script(pg_ctl promote)
failover_command = '/path/to/pgpool_failover_stream.sh %d %H %R'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
SSH=/usr/bin/ssh | |
PGCTL=/usr/bin/pg_ctl | |
failed_node=$1 | |
new_master=$2 | |
cluster_path=$3 | |
# Do nothing if standby goes down. | |
if [ $failed_node != 0 ]; then | |
echo "node number:$failed_node is standby. skip" | |
exit 0; | |
fi | |
# execute promote | |
$SSH -T $new_master $PGCTL promote -D $cluster_path | |
echo "$new_master has been promoted from slave to temp master" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment