Version 8 (modified by chris, 3 years ago) (diff) |
---|
Crin3
This is a 512M RAM Debian Stretch server for running S3QL and doing backups, it was installed on see ticket:11. This server has the other 3 servers, Crin1, Crin2 and Crin4 mounted via SSHFS and it backups up selected directories using S3QL to Advania.
Retrieving backups
If you need to restore a file or database from backups first mount the SQ3L filesystem for the specific server, for example:
sudo -i mnt-s3ql crin1
This will mount the backups at /media/s3ql/crin1 and you can then cd to the directory and list the backups, for example:
cd /media/s3ql/crin1 ls -lah total 0 drwxr-xr-x 1 root root 0 Jul 23 12:18 2015-07-23_12:18:42 drwxr-xr-x 1 root root 0 Jul 23 12:30 2015-07-23_12:22:12 drwx------ 1 root root 0 Jul 23 09:58 lost+found
Database backups can be found in /var/backups/mysql/databases on Crin1, they are produced by the wiki:DumpMysqlTables#backup-mysql script.
To copy files back to one of the other servers you can take advantage of the fact that they are mounted via SSHFS on Crin4, and if they are not it is easy to mount them, for example:
sudo -i mnt-sshfs crin1
Will mount the whole of the Crin1 server at /media/crin1 so retrieved files can be copied directly to the server.
Once you have finished retrieving backup you can unmount the filesystem:
umnt-s3ql crin1
Backup process
There is a root crontab which runs the backups each night:
# m h dom mon dow command 01 01 * * * /usr/local/bin/mnt-s3ql crin1 || /usr/local/bin/mnt-sshfs crin1 || /usr/local/bin/s3ql_backup crin1 || /usr/local/bin/umnt-s3ql crin1 || /usr/local/bin/umnt-sshfs crin1 02 03 * * * /usr/local/bin/mnt-s3ql crin2 || /usr/local/bin/mnt-sshfs crin2 || /usr/local/bin/s3ql_backup crin2 || /usr/local/bin/umnt-s3ql crin2 || /usr/local/bin/umnt-sshfs crin2 03 05 * * * /usr/local/bin/mnt-s3ql crin4 || /usr/local/bin/mnt-sshfs crin4 || /usr/local/bin/s3ql_backup crin4 || /usr/local/bin/umnt-s3ql crin4 || /usr/local/bin/umnt-sshfs crin4
First the S3QL file system is unmounted and checked (in case it has been manually mounted during the day) via wiki:S3QLMnt#unmnt-s3ql, then the remote server is mounted via SSHFS using wiki:SshfsMnt#mnt-sshfs and then the backup is run using a modified version of the S3QL backup script, wiki:S3QLBackup#s3ql_backup, this reads files with lists of directories to backup from /etc/s3ql/ and calls the expire_backups script to delete old backups.
The contents of the files in /etc/s3ql:
crin1
/usr/local /etc /home /root /var/backups /var/www /var/spool/cron/crontabs
crin2
/root /etc /home /var/www /var/backups /usr/local /var/spool/cron/crontabs
crin4
/home /etc /root /var/www /usr/local /var/spool/cron/crontabs