Beaver Backup

Download

Version 1.5: Change Log

Beaver Backup is written in Bash and works on many platforms

Universal Script

Versioned Code

 

 

Features

  • Sane by Default: 2 minutes from download to install & test
  • Concurrent Backups
  • Lightweight Snapshots
  • Simple Server List
  • Simple Email Report
  • Simple & Powerful Configuration Options
  • Supports Scriptlog

 

Background

Beaver backup is a sane by default, rsync auto backup script which is easy to use, easy to deploy, easy to modify that integrates well with centralized logging. Beaver backup is written in bash and takes advantage of background functions to complete jobs concurrently. At the end of a job, beaver sends a report email which was modeled after Legato. Beaver includes a test an easy to use test rig, so you can see if you like it.

 

Architecture

Beaver is based on a simple list of server, a configuration options file, and excludes/includes lists. More powerful configuration options are available in the configuration files. Different copies of beaver backup can be ran on the same server with different configuration files. Beaver backup is normally ran by cron on a central backup box and uses keychain for remote authentication.

Key Files

  • beaver_backup.list: Simple list of servers, using FQDN, one per line
  • beaver_backup.excludes: List of directories to exclude, one per line
  • beaver_backup.includes: List of directories to include, one per line
  • beaver_backup.conf: Configuration file which allows for ssh, rsync, and beaver options

 

Report Breakdown

Sample Report

Rsync backup from evil-blue: Completed, 3 client(s)

Start time: Mon Nov 1 09:19:02 EDT 2010
End time: Mon Nov 1 09:19:31 EDT 2010

--- Successful Save Sets ---
server1.example.com
server2.example.com
server3.example.com

Description

  • Start Date: Date the entire backup started
  • End Date: Date the entire backup finished
  • Successful Save Sets: These are the servers/computers that were backed up successfully
  • Unsuccessful Save Sets: These are the servers/computers that were not backed up successfully. This list is only displayed if there are failures and it is displayed first to catch attention

 

Routine Operations

Setup Keychain

Setting up SSH Keys is critical for backup to occur unattended. This is a good tutorial with a lot of troubleshooting techniques

 

Basic Installation & Setup

Download and install. This will copy everything into /usr/local/etc and /usr/local/bin so you must be root or use sudo to run the following commands.

wget https://crunchtools.com/wp-content/files/crunchtools/beaver/beaver-current.tgz
tar xvfz beaver-current.tgz
cd beaver
./install.sh

Now as root/sudo, run the functional tests. This will add hosts entries and backup your /etc directory to /tmp & test. If everything succeeds, you will have a working setup and can proceed to adding your own hosts

beaver_backup -t

Change the administrative email so that you will receive reports

vi /usr/local/etc/beaver_backup.conf

Change the following line

email_address="[email protected]"

Now as root/sudo, modify the server list. Remove the example entries and place one server per line

vi /usr/local/etc/beaver_backup.list

Now as root/sudo, test the backup

vi /usr/local/bin/beaver_backup.sh

When the job completes, you should receive an email that looks similar to the following

Rsync backup from evil-blue: Completed, 3 client(s)

Start time: Mon Nov 1 09:19:02 EDT 2010
End time: Mon Nov 1 09:19:31 EDT 2010

--- Successful Save Sets ---
server1.example.com
server2.example.com
server3.example.com

 

Advanced Operations

Tuning & Options

Tuning options can be controlled with the beaver_backup.conf file. The following options are supported.

  • source_directory=”/etc”: Source directory on clients servers from which backups will be copied. This is useful for backing up /etc in a different frequency than the whole server
  • destination_directory=”/var/backups”: Destination directory on backup server into which backups will be copied
  • email_support=”true”: Enable/Disable report email
  • email_address=”[email protected]: Email address that will receive the report
  • max_slots=10: Number of jobs which will be run concurrently. For large numbers of backups, this number should be increased
  • max_snapshots=3: Nnumber of snapshots that will be kept on the disk
  • rsync_timeout=3600: Explicitly sets I/O timeout. If no data is sent/received for this number of second, rsync will disconnect
  • ssh_timeout=”10″: Number of seconds to wait on ssh connection. It can be useful to set this shorter than the default TCP timeout in Linux

 

Example Bacula Configuration

This is an example FileSet for use with Bacula. The mtimeonly is critical when using snapshots because, by default, Bacula uses the creation time for incremental backups. This is changed because of a mv command with beaver, so only mtime can be used.

FileSet {
Name = "zebulon.eyemg.com-fs"
Include {
Options {
signature = MD5
noatime=yes
mtimeonly=yes
hardlinks=yes
onefs = yes
}
File = /srv/backup/zebulon.eyemg.com
}
}

 

Good Links

At some point or another, I was influenced by these good links

 

Leave a Reply

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