Off-site Backup with Backupninja: Difference between revisions

From Run Your Own
Jump to navigation Jump to search
Line 58: Line 58:
* rdiff-backup
* rdiff-backup
* choose file to include & exclude, add paths, wildcard accepted
* choose file to include & exclude, add paths, wildcard accepted
* configure backup destination (need to have the backup machine user and IP ready)
* configure backup destination:
** keep <code>120D</code> (you can adjust if you will run out of space! Keep in mind this is incremental though, so don't panic)
** dest_directory <code>/media/lurk_backup/name-of-server-to-backup</code>
** dest_host <code>10.0.1.2</code> Adjust to the Tinc IP of the off-site backup machine.
** dest_user <code>lurk</code>
** dest_type <code>remote</code>
* set up ssh keys and test remote connection
* set up ssh keys and test remote connection

Revision as of 11:00, 25 August 2018

Goal: Setup a remote machine that will be used for incremental backup of critical parts of the LURK servers.

Requirements

This document assumes you already have:

  • A configure Linux/BSD machine to work as off-site backup
  • A lurk user created on the off-site backup that will be used specifically by the backup scripts
  • Debian based servers (not sure Backupninja will run otherwise without some slight modifications)
  • All the machines (servers and the backup machine) on a working Tinc VPN
  • Enough space on the off-site backup machine :)

On the Off-site machine

  • As lurk create directories for each server
mkdir /media/lurk_backup/douglas /media/lurk_backup/agnesbaxter

On each server

Installation

  • As root
apt install backupninja

Configuration

/etc/backupninja.conf

Some changes:

reportemail = some@where.nice
when = everyday at 05:55

MySQL local backups

  • As root run the command:
ninjahelper
  • create a new backup action
  • mysql database backup
  • path:
/var/backups/mysql # adjust if this location does not have much free space
  • all the databases to backup.
  • select the debian maintenance user for access
  • compress the sql output file
  • select the action and test/run/review the config
  • leave ninjahelper

PostgreSQL local backups

  • As root run the command:
ninjahelper
  • create a new backup action
  • postgresql database backup
  • path:
/var/backups/postgres # adjust if this location does not have much free space
  • backup the whole cluster
  • compress the backups
  • custom
  • optional: select the action and test/run/review the config
  • leave ninjahelper

Rdiff backup

This is the action that will not only allow you to select which part of your local filesystem to remotely send and rotate to the off-site backup machine, but it will also make sure the local backups above are sent as well!

  • As root run the command:
ninjahelper
  • create a new backup action
  • rdiff-backup
  • choose file to include & exclude, add paths, wildcard accepted
  • configure backup destination:
    • keep 120D (you can adjust if you will run out of space! Keep in mind this is incremental though, so don't panic)
    • dest_directory /media/lurk_backup/name-of-server-to-backup
    • dest_host 10.0.1.2 Adjust to the Tinc IP of the off-site backup machine.
    • dest_user lurk
    • dest_type remote
  • set up ssh keys and test remote connection