Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #!/bin/bash
  2. # first stage recovery
  3. # $1 datadir
  4. # $2 desthost
  5. # $3 destdir
  6.  
  7. #as I'm using repmgr it's not necessary for me to know datadir(master) $1
  8. RECOVERY_NODE=$2
  9. CLUSTER_PATH=$3
  10. #repmgr needs to know the master's ip
  11. MASTERNODE=`/sbin/ifconfig eth0 | grep inet | awk '{print $2}' | sed 's/addr://'`
  12.  
  13. cmd1=`ssh postgres@$RECOVERY_NODE "repmgr -D $CLUSTER_PATH --force standby clone $MASTERNODE"`
  14. echo $cmd1
  15.  
  16. #! /bin/sh
  17.  
  18. if [ $# -ne 2 ]
  19. then
  20. echo "pgpool_remote_start remote_host remote_datadir"
  21. exit 1
  22. fi
  23.  
  24. DEST=$1
  25. DESTDIR=$2
  26. PGCTL=/usr/pgsql-9.4/bin/pg_ctl
  27.  
  28. ssh -T $DEST $PGCTL -w -D $DESTDIR start 2>/dev/null 1>/dev/null < /dev/null &
  29.  
  30. #!/bin/sh
  31. failed_node=$1
  32. new_master=$2
  33. (
  34. date
  35. echo "Failed node: $failed_node"
  36. set -x
  37.  
  38. # Promote standby/slave to be a new master (old master failed)
  39. /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 <&-"
  40. exit 0;
  41. ) 2>&1 | tee -a /tmp/pgpool_failover.log
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement