Failover IP - How To?

  • Hi,

    I am running a couple of VPS at netcup and try to add a failover Ip support on 2 VPS.

    Currently, all my VPS are under Ubuntu 18.04

    I installed keepalived and configured the netplan config file by adding my Failover IP on both VPS.

    I expected when I shutdown my master VPS, the Failover IP automatically switches to the the slave VPS but it's not the case.. :(

    It only works if I assign the Failover IP using the SCP.


    Any help?

  • Hat diesbezüglich jemand ein fertiges Script welches den online Status der Server prüft und bei Bedarf dann das umrouten erledigt und möchte dies hier teilen?


    Und wie löst Ihr das Problem wenn der Server auf dem das Script läuft selbst offline sein sollte? Oder führt man das Script dann einfach mehrfach redundant auf allen Servern aus welche sich dann gegenseitig überprüfen?



    Eigentlich auch nur eine weitere Spielerei die ich nicht benötige aber ich habe jetzt schon mehrere Monate ne Failover-IP unbenutzt rumliegen und eventuell sollte man sich das ganze doch Mal zu Gemüte führen. ^^

  • Wenn man keepalived verwendet sollte jeder Node das Skript zum umrouten der Failover IP haben. Solange dann noch ein Node verfügbar ist, kann er sich die Failover IP zuweisen, wenn der Master weg ist.

  • Und wie löst Ihr das Problem wenn der Server auf dem das Script läuft selbst offline sein sollte? Oder führt man das Script dann einfach mehrfach redundant auf allen Servern aus welche sich dann gegenseitig überprüfen?

    Quorum or STONITH.


    I don't think it is very helpful if you are answering on am English thread in German.

  • I finally found the solution after reading some posts on the forum :)

    Thanks voja and H6G

    If that can help.
    First of all, (I didn't know) for using the API, I had to activate it...and generate password.


    I update my keepalived.conf like this


    For the master



    For the slave


    And my failover.sh script looks like this


    Code
    #!/usr/bin/env bash
    CURL_BODY='<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://enduser.service.web.vcp.netcup.de/"><SOAP-ENV:Body><ns1:changeIPRouting><loginName>LOGIN_NAME</loginName><password>PASSWIRD</password><routedIP>FAILOVERIP</routedIP><routedMask>32</routedMask> <destinationVserverName>SERVER_NAME</destinationVserverName><destinationInterfaceMAC>SERVER_NAME_MAC_ADDR</destinationInterfaceMAC></ns1:changeIPRouting></SOAP-ENV:Body></SOAP-ENV:Envelope>'
    CURL_OUTPUT=$(curl -s -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:" -d "$CURL_BODY" -X POST https://www.servercontrolpanel.de:443/WSEndUser?xsd=1)
    echo "Failover IP basculee " | mail -s "Basculement IP" stan@email.com


    I have to write a better a script especially for handling the response of the API.