Article overview

Help article

Linux redundancy: intro and requirements

TransIP offers you the possibility to spread your services geographically over our availability zones. This makes it possible to set up a redundant VPS environment in which, when a hypervisor goes offline, for example, your customers will not notice it.

In this tutorial series, we show you how to set up a redundant environment for hosting websites, including database(s), and ensure that your data remains synchronized between VPSs. There are no one-size-fits-all solutions for all conceivable scenarios, so we recommend reading these tutorials before you follow the steps described.

Setting up a redundant VPS environment is covered in the following sections:

  1. Introduction, requirements, use cases
  2. Updating and synchronizing your websites (Rsync)
  3. Synchronizing your database (master-slave)
  4. Failover of your database (MaxScale and MariaDB-Monitor)
  5. Linking your database to your application with Keepalived (PHP, WordPress)
  6. Additional tips

Concepts such as RSync, master-slave, etc. are explained in more detail in the relevant sections.

  • For this tutorial series, we assume that you are familiar with setting up a secure VPS with a web server and MariaDB server and related material, such as SQL queries. This material is not covered any further in these tutorial series.
  • First, create a snapshot of your VPSs before you start this tutorial series, so you always have a backup if you accidentally make an undesirable configuration adjustment.
  • The VPSs we use for these tutorial series are supplied with: CentOS 7, Apache 2.4.6 (web server), proFTPD 1.3.6 (ftp server) and MariaDB 10.2 (SQL server). Where relevant, we also provide the installation steps for Ubuntu/Debian in this tutorial series for any additional software (tested on Ubuntu 16.04).
  • MariaDB 10.2 or later is required to set up an SQL cluster as in these tutorials. When we talk about SQL in these tutorials, we refer to MariaDB's SQL.
  • The security of the VPSs is up to you. Where, for example, ports have to be opened, we will indicate which ports.

Use case

The purpose of this tutorial series is to show you how to set up redundant web servers and SQL servers in a broad sense on VPSs with CentOS7 and Debian 8/Ubuntu 16.04 or later. The principles are also applicable to websites hosted on servers which use a control panel (e.g. Plesk), but this is not officially supported by the developers of these control panels and falls outside the scope of this tutorial series. 

We show you a way to set up a continuous synchronization for the websites you host on your VPS. This synchronizes website updates to your web servers and keeps files synchronized. 

In addition, we show you how to set up a redundant SQL configuration in which you host the same database(s) on multiple servers, with or without automatic failover (your choice) and load balancing. The main goal is to introduce you to various tools which you can use to set up redundant web servers and SQL servers. The final result of the configuration discussed in this tutorial series is: 

  • Websites: The websites refer to HA-IP Pro in their DNS settings. This achieves load balancing and failover:
    • Load balancing: Visitors are automatically distributed over the two linked VPSs.
    • Failover: If one of the web servers is unreachable, the other will take all the traffic. 

    We use Rsync to synchronize the files on the websites. 
  • SQL: We use a master-slave setup for the SQL database:
    • For a master-slave setup, the SQL master executes all write (create, drop, etc.) SQL queries to itself and to all linked slave VPSs. Suppose a visitor registers on your website, then that data is usually recorded in a write query.
    • The read queries are executed on the private LAN IP address of the SQL servers.
    • MaxScale ensures that when the master becomes unreachable, one of the linked slaves automatically becomes the new master.
    • We use a virtual IP address to ensure that write queries are always sent to the current master. 

We used two VPSs as web servers and two VPSs as SQL servers for writing this series. 

VPS monitoring 

If a VPS goes offline in your redundant setup, you want to be on top of that of course. Always set up monitoring for your VPSs. You will then automatically receive an email if one of your VPSs becomes unreachable. 

What do I need to set up a redundant VPS environment? 

To set up a redundant VPS environment as in this tutorial series, you need at least two VPSs in each availability zone. In each availability zone, you have one VPS that serves as a web server and one VPS that serves as a database (SQL) server. You need at least the following products for such a redundant setup: 

  • Four VPSs: Two in one availability zone (Amsterdam), and two in another (Delft). Set up two VPSs as identical web servers and two as identical SQL servers with MariaDB 10.2 or later. In theory you can have the web server and SQL server on the same VPS (as the control panels do), but to reduce the number of possible attack points, we chose to split these in this tutorial series and to have the SQL servers only accessible from the private network.

    In order to achieve this setup, you could completely set up a web server and SQL server in our availability zone in Amsterdam and then clone both to two new VPSs in Delft. Alternatively, you can choose an availability zone when ordering the VPSs and set them up completely from scratch. 
  • HA-IP Pro: HA-IP Pro is an out-of-the-box load balancer with automatic failover. We use HA-IP Pro in this tutorial series to distribute incoming traffic evenly over your web servers.
  • Private network: For optimal operation of your redundant setup, you want to synchronize all files between your VPSs. With a private network, the synchronization between both VPSs will not contribute to the data traffic of your traffic pool. In addition, it is desirable to have your web servers communicate with the SQL servers via a private network and make them publicly inaccessible (more about this in a later part of the tutorial). 


  • Big Storage: If you store large amounts of data, we recommend using Big Storage (one in one availability zone, and one in the other). With Big Storage, you can add up to 400TB of storage to a VPS.

HA-IP Pro configuration 

If you want to follow this tutorial series one-to-one, you need the following settings in HA-IP Pro. 

Linking VPSs 

Only link your web servers to HA-IP Pro (not your SQL servers). 

Load balancing 

The choice of a load balancing method is a personal one and you are completely free to do so. We use Round Robin for a even distribution over the VPSs. 

ha-ip pro loadbalancing method

TCP port settings 

There are two types of traffic that you have to forward in HA-IP Pro: HTTP and HTTPS, traffic. Set up HA-IP Pro as in the screenshot below. For more information about HA-IP pro, see our article on HA-IP Pro

ha-ip tcp port settings

See our 'What is HA-IP Pro' article for more information about setting up the Health Check.

DNS settings 

In the DNS settings of the domain you use for these tutorials, refer the A record and AAAA record to your IPv4 and IPv6 address of HA-IP Pro respectively.


We have reached the end of the introductory part of setting up a redundant VPS environment. Before continuing, make sure you have the following configuration ready:

  • Two identical web servers with an Apache or Nginx server, with an SFTP / FTPS server.
  • The web servers are linked to HA-IP Pro.
  • Two identical VPSs with MariaDB 10.2+
  • All four VPSs are linked to your private network.
  • At least one domain linked to HA-IP Pro in the DNS. 

Then, click here to continue with part two: synchronize your websites.


Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘ContactUs’ button at the bottom of this page.

If you want to discuss this article with other users, please leave a message under 'Comments'.


Do you have a good idea?

Give us your idea! If it's popular we'll add it to the wishlist!

Has this article been helpful?

Create an account or log in to leave a rating.


Create an account or log in to be able to leave a comment.

Are you stuck?

Ask one of our specialists to assist you

Contact us