Setup Real-time Backup on Ubuntu

Home » Backup » Setup Real-time Backup on Ubuntu
Setup Real-time Backup on Ubuntu
Learn how to setup real-time backup on Ubuntu. Protect your data from being lost by an automatic robust backup method.

Why it is Important to Run a Backup on Ubuntu?

You will never feel the importance of the backup on Ubuntu unless you lose important content. Do you know that before developing our exclusive method to create a robust backup on Ubuntu, we lost an important data by mistake! Therefore, we learned a lesson not to miss a real-time backup for anything important on your server. We developed a robust automated methods to backup data as a result of that sudden loss. In addition, the method we expose here is 100% guaranteed to protect your data from being lost.

What Will We Cover?

In this section, we will make a robust backup environment. Then, we will show you our best practice sync backup folders in real-time.

Backup Infrastructure

In the first place, we will create a backup infrastructure. That is to say, to make it easy to have a separate backup for every instance on your server. For example, you can run a backup for website A, website B or even the mail server files.

Generate Backup on Ubuntu

Once the backup infrastructure is ready, we can generate the backup zip files for the site files, mail server files and the database.

Real-time Syncing

Before staring real-time syncing with a destination, we should get and prepare the destination backup server. Once the backup server is ready, we will start the real-time sync process between the source and destination. For this purpose, we will use Rsync utility.

Sync Backup Directories with Remote Server

Real time syncing between two servers can be done when using Rsync on Linux and iNotifyWait utilities together. We will show you how it’s easy to sync website folders and emails. Also, we will sync the master backup folder.

Sync Backup Directories with Local Computer

It’s very important to keep a copy of your files on your local machine. For this purpose, we will download the WinSCP. Then, we will create a Rsync Linux user. After that, we will show you the sync settings and start the sync process.

Real-time Database Syncing

The previous two sync methods can keep a copy of all your important files on two destinations but this is not enough. We will implement a full MySQL master slave replication system in order to keep the database synced in real-time. Before starting the sync process, we will configure the master and slave. Then, we will secure the connection via SSL. After that, will export the databases from the master to slave. Finally, we will start the sync process.

Detailed Table of content

  1. Backup Infrastructure Setup
    1. Manual Creation (9 steps)
    2. Automatic Creation (4 steps)
  2. Backup MySQL and Site Files on Source Server (7 steps)
  3. Real Time Sync for Master Backup Directory Between Servers via Rsync and iNotifyWait
    1. Linux Backup Server Setup (4 steps)
    2. Rsync Linux User Creation and Test (7 steps)
    3. Real Time Sync via iNotifyWait (8 steps)
    4. Restore MySQL on Destination Server from Backup (8 steps)
      1. Create Restore Script
      2. Restore All MySQL Databases via restore_db.sh Bash Script
      3. Single Database Restoration via restore_db.sh Bash Script
  4. Real Time Sync for Master Backup Directory with Local Computer
  5. Real Time Sync for Database via MySQL Replication