Debian IP Failover With UCARP

If you’ve ever looked into high-availability, you are well aware that there are probably one hundred different solutions. In this article we will show you our no nonsense solution using software called UCARP. Using this simpler approach you will have a pair of hosts each of which is prepared to take over a single Virtual IP Address (VIP) – this is what ucarp allows you to do. The premise behind ucarp is each host will have their own IP address, but each of them will also be able to grab a “floating” VIP. This address is the one that will provide high-availability. In our example below I have two hosts running a MariaDB Galera Cluster, lets call them GC01 & GC02 respectively. Using ucarp you’d then configure an IP address which would be live on only one host at a time. This shared IP address is then the address that MariaDB would listen on. So without further ado, first we will need to install ucarp using the following command.

Once installed, you will want to edit the /etc/network/interfaces on each server to include the new VIP address. Below are the respective server interfaces files. Please take note, that the new interface is called eth0:ucarp on each server.

GC01 – MariaDB Galera Cluster Node A

GC02 – MariaDB Galera Cluster Node B

Above, you will notice that on the primary interface we have added our ucarp entries. Most of these are pretty self explanatory, however it is important to note that the ucarp-vid setting must be unique to each group of servers. It is also important to note that ucarp-master yes may only be defined on one server per group. For a detailed explanation of each setting, please refer to the Ubuntu ucarp manpage.

Did you find this article useful? Why not share it with your friends?

4 thoughts on “Debian IP Failover With UCARP

  1. Hi,

    great and helpful article. It works fine running ucarp manually. But how to start ucarp automatically at boot? I’m wondering if I have to write my own init scripts. Running Ubuntu 14.04.3 and ucarp 1.5.2-1

    Best Regards,

    1. Give this a try. In the command line run the following command:

    2. Fixed. Why choosing such a complicated solution if you can use the if-up.d or if-down.d-scripts?! Feel free to remove my latest comment. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.