Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This document is a guide to backing up Abiquo. Every Abiquo installation is different so you must ensure that your backup configuration is appropriate for your installation. This guide gives a general explanation of which parts of Abiquo need to be backed up and how to do this manually and with Rsnapshot.

...

Create backups

Abiquo Server, Remote Services and V2V

Save Abiquo directory

Code Block
$ cp -R /opt/abiquo /path/to/backup/

Abiquo Server

Save MySQL data:

Code Block
$ mysqldump kinton --routines --triggers > /path/to/backup/mysql/kinton-dump.sql

$ mysqldump kinton_accounting --routines --triggers > /path/to/backup/mysql/kinton_accounting-dump.sql

Save Redis data:

Code Block
$ redis-cli
redis> SAVE
redis> exit
$ cp /var/lib/redis/dump.rdb /path/to/backup/redis

Abiquo Remote Services

Save DHCPD leases generated by Abiquo:

...

Code Block
$ cp /etc/fstab /path/to/backup/fstab

Restore

...

backups

Abiquo Server, Remote Services, and V2V

Restore Abiquo properties:

Code Block
$ cp /path/to/backup/abiquo/config/abiquo.properties /opt/abiquo/config/abiquo.properties

Abiquo Server

Restore MySQL data:

Code Block
$ /etc/init.d/abiquo-tomcat stop
$ mysql kinton < /path/to/backup/mysql/kinton-dump.sql
$ mysql kinton_accounting < /path/to/backup/mysql/kinton_accounting-dump.sql
$ /etc/init.d/abiquo-tomcat start

...

Code Block
$ /etc/init.d/redis stop
$ cp /path/to/backup/redis/dump.rdb /var/lib/redis
$ /etc/init.d/redis start

Abiquo

...

remote services

Restore /etc/fstab configuration:

...

Code Block
$ /etc/init.d/dhcpd stop
$ cp /path/to/backup/dhcp/dhcpd.leases* /var/lib/dhcpd/
$ /etc/init.d/dhcpd start

Restart Abiquo

Now you can restart the Abiquo Tomcat daemon:

Code Block
$ service abiquo-tomcat restart

Configure a

...

remote backup server

Now we will describe how to configure a remote CentOS server to do the backups via rsnapshot. In this example we have an Abiquo Server (10.60.20.100) and an Abiquo Remote Services Server (10.60.20.101).

Prepare backup server

First of all, on the backup server, install rsnapshot (you may need to install RPMForge repositories (first, you can follow the follow the CentOS RPMForge guide) and then install rsnapshot:

Code Block
$ rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
$ wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
$ rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
$ yum -y install rsnapshot

...

Code Block
$ mkdir /opt/backups

Generate SSH keys

We need to set up SSH passwordless keys without passwords in order to do backups automatically. Generate a pair of public/private keys on the backup server, leaving the passphrase empty:

Code Block
$ ssh-keygen -t dsarsa
Generating public/private dsarsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsarsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_dsarsa.
Your public key has been saved in /root/.ssh/id_dsarsa.pub.
The key fingerprint is:

...

Code Block
$ ssh-copy-id -i ~/.ssh/id_dsarsa.pub root@10.60.20.100
$ ssh-copy-id -i ~/.ssh/id_dsarsa.pub root@10.60.20.101


Install rsync

After you have successfully completed the above steps, you can install rsync on the target hosts:

Code Block
$ ssh root@10.60.20.100 "yum -y install rsync"
$ ssh root@10.60.20.101 "yum -y install rsync"

Configure rsnapshot

Note

Elements in this file must be separated by tabs, and directories must end with a trailing slash '/'. Be careful of this if you do a copy & paste. You can split long lines by beginning a new line with a space or a tab character. All leading and trailing whitespace will be stripped off the new line, then it will be joined to the previous line with a tab character during configuration file parsing.

...

As you can see in the configuration above, we use scripts in order to do MySQL and Redis dumps. The scripts are stored on the backup server. Put them under your /opt/backups/ directory, and modify the HOST variable to suit your needs:

...

backup_mysql.sh

Code Block
#!/bin/bash
HOST="10.60.20.100"
MYSQL_DB="kinton"
FILE=${MYSQL_DB}.$(date +"%Y%m%d-%H%M%S").sql.gz

# dump the database and gzip it
ssh root@${HOST} "mysqldump ${MYSQL_DB}" | gzip -9 > ${FILE}
Code Block
borderStylesolid
title

backup_redis.sh

Code Block
#!/bin/bash
HOST="10.60.20.101"
REDIS_DUMP="/var/lib/redis/dump.rdb"
FILE=dump.$(date +"%Y%m%d-%H%M%S").rdb.gz

# dump the database and gzip it
ssh root@${HOST} "redis-cli save"
ssh root@${HOST} "cat ${REDIS_DUMP}"  | gzip -9 > ${FILE}

...

Code Block
$ chmod +x /opt/backups/*.sh

...

Set up crontab

Automation is easily attainable using a simple crontab entry. Open /etc/crontab and add the following:

...