Created
August 10, 2016 13:00
-
-
Save silenius/b81e577f0f0a37bf7773ef15f7d05b5d to your computer and use it in GitHub Desktop.
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
| ~/ salt "filer2.prod.lan" cmd.run "cat /usr/local/etc/devd/filer_failover.conf" | |
| filer2.prod.lan: | |
| notify 0 { | |
| match "system" "CARP"; | |
| match "subsystem" "54@bge0"; | |
| match "type" "(MASTER|BACKUP)"; | |
| action "/root/scripts/filer_failover.sh $type"; | |
| }; | |
| ~/ salt "filer2.prod.lan" cmd.run "cat /root/scripts/filer_failover.sh" | |
| filer2.prod.lan: | |
| #!/bin/sh | |
| log_name="filer" | |
| log_prio="user.notice" | |
| flog () { | |
| logger -p "$log_prio" -t "$log_name" "$1" | |
| } | |
| case "$1" in | |
| MASTER) | |
| flog "Shutting down the replication interface" | |
| sysrc ifconfig_bge1="down" | |
| ifconfig bge1 down | |
| # Backup is the new master | |
| sysrc ifconfig_bge0_alias0="vhid 54 advskew 10 pass xxx alias 192.168.10.15/32" | |
| flog "Adapting advskew on the main interface" | |
| ifconfig bge0 vhid 54 advskew 10 | |
| flog "Shutting down the CTLD daemon" | |
| service ctld stop | |
| while pgrep -u root ctld > /dev/null ; do | |
| sleep 0.01 | |
| done | |
| flog "Import data zpool" | |
| zpool import -f -o cachefile=none data | |
| ;; | |
| BACKUP) | |
| flog "MASTER -> BACKUP" | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment