Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- auto eth0:0
- iface eth0:0 inet static
- address W.X.Y.Z
- netmask 255.255.255.224
- Trying W.X.Y.Z ...
- * connect to W.X.Y.Z port 443 failed: Connection refused
- * Failed to connect to domain.com port 443: Connection refused
- * Closing connection 0
- curl: (7) Failed to connect to domain.com port 443: Connection refused
- The failover IP is W.X.Y.Z and is also the A record of domain.com
- The /etc/hosts file for both nodes serverA and serverB looks like:
- 127.0.0.1 localhost
- 127.0.1.1 luminarhost
- xxx serverA
- xxx serverB
- The /etc/network/interfaces of serverA
- ### Hetzner Online AG - installimage
- # Loopback device:
- auto lo
- iface lo inet loopback
- # device: eth0
- auto eth0
- iface eth0 inet static
- address xxx
- broadcast xxx
- netmask xxx
- gateway xxx
- # default route to access subnet
- up route add -net xxx netmask 255.255.255.224 gw xxx eth0
- iface eth0 inet6 static
- address xxx
- netmask xxx
- gateway xxx
- # failover ip
- auto eth0:0
- iface eth0:0 inet static
- address W.X.Y.Z
- netmask 255.255.255.224
- and of serverB it is:
- ### Hetzner Online AG - installimage
- # Loopback device:
- auto lo
- iface lo inet loopback
- # device: eth0
- auto eth0
- iface eth0 inet static
- address xxx
- broadcast xxx
- netmask xxx
- gateway xxx
- # default route to access subnet
- up route add -net xxx netmask 255.255.255.192 gw xxx eth0
- iface eth0 inet6 static
- address xxx
- netmask xxx
- gateway xxx
- # failover ip
- auto eth0:0
- iface eth0:0 inet static
- address W.X.Y.Z
- netmask 255.255.255.224
- #!/bin/sh
- date >> /var/tmp/failover_after.txt
- # this below line makes sure it deletes the floating ip after it successfully switched
- set -o xtrace && ssh -o StrictHostKeyChecking=no $2 'ip addr del '"$1"'/32 dev `route | grep "^default" | grep -o "[^ ]*$"`' && set +o xtrace >> /var/tmp/failover_after.text
- echo "To: yourmail@gmail.com
- From: noreply@dummydomain.in
- Subject: Heartbeat notice from `/bin/hostname`
- Switched failover ip $1 from $2 to $3" | /usr/sbin/sendmail -t
- # use https://github.com/course-hero/slacktee
- echo "👍 Switch success for failover ip $1 from $2 to $3"| slacktee.sh
- #!/bin/sh
- date >> /var/tmp/failover_after.txt
- set -o xtrace && ssh -o StrictHostKeyChecking=no $2 'ip addr del '"$1"'/32 dev `route | grep "^default" | grep -o "[^ ]*$"`' && set +o xtrace >> /var/tmp/failover_after.text
- echo "To: yourmail@gmail.com
- From: noreply@dummydomain.in
- Subject: Heartbeat notice from `/bin/hostname`
- Switched failover ip $1 from $2 to $3" >> /var/tmp/failover_after.txt
- echo "To: nizam.sp@gmail.com
- From: noreply@whereismytrain.in
- Subject: Heartbeat notice from `/bin/hostname`
- Switched failover ip $1 from $2 to $3" | /usr/sbin/sendmail -t
- echo "👍 Switch success for failover ip $1 from $2 to $3"| slacktee.sh
Add Comment
Please, Sign In to add comment