Automated Node Backups
From SolusVM
Contents |
Overview
Please Note: This Backup Method is no Longer supported, please use: http://wiki.solusvm.com/index.php/Automated_Backups
This tool allows you to backup all your clients containers, configs and SolusVM data to a remote backup server using rsync.
We know of several large hosting companies who use this system and it seems to work well for them, so we thought we would make it an option for you aswell.
Using rsync is a good way to save on bandwidth and node resources plus keeping everything tidy and uptodate.
File Structure
This tool will store all files in a logical file structure and allow you to use the same backup server for any amount of nodes.
The file structure is as follows:
REMOTE_DIR >> SERVER_1 SERVER_2 SERVER_3 etc...
Each node backed up to the same REMOTE_DIR will be stored under its own directory based on its hostname.
Setup
Setting up SSH Keys
First of all you will need to setup the SSH keys. On the slave node run the following:
wget http://files.soluslabs.com/solusvm/scripts/keyput.sh chmod a+x keyput.sh ./keyput.sh <backup_server_ip> <backup_server_port>
backup_server_ip = the ip of the backup server.
backup_server_port = the SSH port of the backup server.
Backup Configuration
edit the file /usr/local/solusvm/backup/backup-example.conf
nano -w /usr/local/solusvm/backup/backup-example.conf
Variables
PRIVATE_DIR ....: The directory where all the containers are held (must include trailing slash) CONF_DIR .......: The directory where all the vz config files are held REMOTE_HOST ....: The ip address of the backup server REMOTE_PORT ....: The port SSH runs on the backup server REMOTE_DIR .....: The directory you want the backups to be stored in on the backup server EMAIL ..........: Alert email address
After you have edited the file, close it (CTRL+W) and rename it to backup.conf
mv /usr/local/solusvm/backup/backup-example.conf /usr/local/solusvm/backup/backup.conf
Usage
To manually run a node backup:
/usr/bin/solusvmbackup
- You might want to make sure if /usr/bin/solusvmbackup is Executable (in 755 mode).
To automatically run a backup nightly:
export EDITOR=nano crontab -u root -e
Add the following: (This will run the backup at 1:30AM)
30 1 * * * /bin/nice -n19 /usr/bin/ionice -c3 /usr/bin/solusvmbackup > /dev/null 2>&1
Press CTL+X to save and exit.
Troubleshooting
If the backup stalls half way through the transfer you will get an error next time you attempt to run the backup.
Error: Lock file exists! is a proccess running already?
To fix this simply remove the lock file.
rm -f /usr/local/solusvm/backup/backup.lck
