Webdevelopment
Drupal
Betriebssysteme
Design
Sonstige
Denk dran. Wenn man rsnapshot als root laufen lässt müssen sich die keys auch logischerweise in /root/.ssh befinden.
Rsnapshot config file /etc/rsnapshot.conf Beispiel remote backup script
#server 1
#Schritt 1 run mysql backup script sync_first backup_script
backup_script /usr/bin/ssh ssh-XXXX@1.1.1.1 '/multisite_db_backup_distri3.sh' tmp/all-inkl-1
#Schritt 2 backup data
backup ssh-XXXX@1.1.1.1:/www/htdocs/XXXX/PRODUCT_DISTRI4 all-inkl-1/data/
backup ssh-XXXX@1.1.1.1:/drush-backups/ all-inkl-1/mysql/
WICHTIG: Zwischen den Kommandos müssen TABs stehen keine SPACES! ABER beim ausführen des remote scripts stehen TABS nur nach backup_script und vor tmp/all-inkl-1
Ansonsten wird das Kommando /usr/bin/ssh ssh-XXXX@1.1.1.1 '/multisite_db_backup_distri3.sh' nicht als Kommando ausgeführt!
Wir lassen zuerst ein Script auf dem Server laufen, welches die Datenbanken in einen Ordner sichern, hier "/drush-backups/
"
Im Schritt 2 backuppen wir dann diesen ordner so wie den gesamten Datenordner. Einfach schnell und automatisiert.
Chronjobs
Wir müssen noch chronjobs anlegen wenn wir es automatisiert wollen. Dazu siehe config von rsnapshot:
#########################################
# BACKUP LEVELS / INTERVALS #
# Must be unique and in ascending order #
# e.g. alpha, beta, gamma, etc. #
#########################################
#retain hourly 6
retain daily 7
retain weekly 4
retain monthly 4
Hier haben wir die Levels festgelegt und die lassen wir per Chron laufen. Je nachdem was ihr benutzt crontab cron.d oder andere crondienste.
Beispiel
# 30 3 * * * root /usr/bin/rsnapshot daily # 0 3 * * 1 root /usr/bin/rsnapshot weekly # 30 2 1 * * root /usr/bin/rsnapshot monthly
Quellen
- https://wiki.archlinux.org/index.php/Rsnapshot https://www.thomas-krenn.com/de/wiki/Backup_unter_Linux_mit_rsnapshot http://rsnapshot.org/rsnapshot/docs/docbook/rest.html#backup-script
- http://blog.undkonsorten.com/heimgeholt-gesichert-inkrementelle-backups-mit-rsync-und-rsnapshot-erstellen
- http://www.server-wissen.de/linux-debian/backup-linux-debian/backup-strategie-mit-rsnapshot/
- http://www.tecmint.com/rsnapshot-a-file-system-backup-utility-for-linux/
- https://wiki.ubuntuusers.de/rsnapshot/ https://bash.cyberciti.biz/backup/rsnapshot-remote-mysql-backup-shell-script/ http://jeremymarc.github.io/2012/12/10/simple-backups-with-rsnapshot
- http://www.synology-wiki.de/index.php/Backup_der_MySQL-Datenbank_%C3%BCber_einen_cronjob
- https://www.howtoforge.com/set-up-rsnapshot-archiving-of-snapshots-and-backup-of-mysql-databases-on-debian
- https://linuxforge.wordpress.com/2010/10/06/rsnapshot-remote-mysql-backup-shell-script/
- https://wiki.archlinux.de/title/Rsnapshot | da ich manjaro nutze
- https://serverfault.com/questions/984317/rsnapshot-remote-backup-script-execution-using-non-standard-ssh-port-and-key