Guest User

Untitled

a guest
Apr 6th, 2018
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. auto eth0:0
  2. iface eth0:0 inet static
  3. address W.X.Y.Z
  4. netmask 255.255.255.224
  5.  
  6. Trying W.X.Y.Z ...
  7. * connect to W.X.Y.Z port 443 failed: Connection refused
  8. * Failed to connect to domain.com port 443: Connection refused
  9. * Closing connection 0
  10. curl: (7) Failed to connect to domain.com port 443: Connection refused
  11.  
  12. The failover IP is W.X.Y.Z and is also the A record of domain.com
  13.  
  14. The /etc/hosts file for both nodes serverA and serverB looks like:
  15.  
  16. 127.0.0.1 localhost
  17. 127.0.1.1 luminarhost
  18. xxx serverA
  19. xxx serverB
  20.  
  21. The /etc/network/interfaces of serverA
  22.  
  23. ### Hetzner Online AG - installimage
  24. # Loopback device:
  25. auto lo
  26. iface lo inet loopback
  27.  
  28. # device: eth0
  29. auto eth0
  30. iface eth0 inet static
  31. address xxx
  32. broadcast xxx
  33. netmask xxx
  34. gateway xxx
  35. # default route to access subnet
  36. up route add -net xxx netmask 255.255.255.224 gw xxx eth0
  37.  
  38. iface eth0 inet6 static
  39. address xxx
  40. netmask xxx
  41. gateway xxx
  42.  
  43. # failover ip
  44. auto eth0:0
  45. iface eth0:0 inet static
  46. address W.X.Y.Z
  47. netmask 255.255.255.224
  48.  
  49. and of serverB it is:
  50.  
  51. ### Hetzner Online AG - installimage
  52. # Loopback device:
  53. auto lo
  54. iface lo inet loopback
  55.  
  56. # device: eth0
  57. auto eth0
  58. iface eth0 inet static
  59. address xxx
  60. broadcast xxx
  61. netmask xxx
  62. gateway xxx
  63. # default route to access subnet
  64. up route add -net xxx netmask 255.255.255.192 gw xxx eth0
  65.  
  66. iface eth0 inet6 static
  67. address xxx
  68. netmask xxx
  69. gateway xxx
  70.  
  71. # failover ip
  72. auto eth0:0
  73. iface eth0:0 inet static
  74. address W.X.Y.Z
  75. netmask 255.255.255.224
  76.  
  77. #!/bin/sh
  78.  
  79. date >> /var/tmp/failover_after.txt
  80. # this below line makes sure it deletes the floating ip after it successfully switched
  81. 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
  82.  
  83. echo "To: yourmail@gmail.com
  84. From: noreply@dummydomain.in
  85. Subject: Heartbeat notice from `/bin/hostname`
  86. Switched failover ip $1 from $2 to $3" | /usr/sbin/sendmail -t
  87.  
  88. # use https://github.com/course-hero/slacktee
  89. echo "👍 Switch success for failover ip $1 from $2 to $3"| slacktee.sh
  90.  
  91. #!/bin/sh
  92.  
  93. date >> /var/tmp/failover_after.txt
  94. 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
  95.  
  96. echo "To: yourmail@gmail.com
  97. From: noreply@dummydomain.in
  98. Subject: Heartbeat notice from `/bin/hostname`
  99. Switched failover ip $1 from $2 to $3" >> /var/tmp/failover_after.txt
  100.  
  101. echo "To: nizam.sp@gmail.com
  102. From: noreply@whereismytrain.in
  103. Subject: Heartbeat notice from `/bin/hostname`
  104. Switched failover ip $1 from $2 to $3" | /usr/sbin/sendmail -t
  105.  
  106. echo "👍 Switch success for failover ip $1 from $2 to $3"| slacktee.sh
Add Comment
Please, Sign In to add comment