Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # first stage recovery
- # $1 datadir
- # $2 desthost
- # $3 destdir
- #as I'm using repmgr it's not necessary for me to know datadir(master) $1
- RECOVERY_NODE=$2
- CLUSTER_PATH=$3
- #repmgr needs to know the master's ip
- MASTERNODE=`/sbin/ifconfig eth0 | grep inet | awk '{print $2}' | sed 's/addr://'`
- cmd1=`ssh postgres@$RECOVERY_NODE "repmgr -D $CLUSTER_PATH --force standby clone $MASTERNODE"`
- echo $cmd1
- #! /bin/sh
- if [ $# -ne 2 ]
- then
- echo "pgpool_remote_start remote_host remote_datadir"
- exit 1
- fi
- DEST=$1
- DESTDIR=$2
- PGCTL=/usr/pgsql-9.4/bin/pg_ctl
- ssh -T $DEST $PGCTL -w -D $DESTDIR start 2>/dev/null 1>/dev/null < /dev/null &
- #!/bin/sh
- failed_node=$1
- new_master=$2
- (
- date
- echo "Failed node: $failed_node"
- set -x
- # Promote standby/slave to be a new master (old master failed)
- /usr/bin/ssh -T -l postgres $new_master "/usr/pgsql-9.4/bin/repmgr -f /var/lib/pgsql/repmgr/repmgr.conf standby promote 2>/dev/null 1>/dev/null <&-"
- exit 0;
- ) 2>&1 | tee -a /tmp/pgpool_failover.log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement