barcamp gent 2: rsnapshot

Download Barcamp Gent 2: rsnapshot

If you can't read please download the document

Upload: peter-dedecker

Post on 19-May-2015

1.679 views

Category:

Technology


0 download

DESCRIPTION

automated, easy and green backups with rsnapshot

TRANSCRIPT

  • 1. rsnapshot easy and automated backup/restore, snapshot style

2. This is not about

  • Backup strategy
    • What and when
    • overhead?
  • I just had a crash, please help me

3. Classic trade-off

  • Full backup
    • Large backup time
    • Quick and easy restore
    • Space consuming
  • Incremental backups
    • Quick backup
    • Complex and time consuming restore
    • More space efficient

4. rsnapshot

  • Combines full and incremental backups
    • But off course only the good things
  • Quick backup process
  • Quick and easy restore
  • Space efficient
  • Remote, on harddisks, no tape switching

5. Amazing! But how?

  • I'll explain you!

6. Built on two key concepts

  • Rsync
  • Hardlinks

7. rsync

  • synchronizes files and directories
  • minimizing data transfer using delta encoding
  • optionally using compression and recursion.
  • daemon
  • native rsync protocol or SSH
  • free software
  • default on most UNIXs

8. Hardlinks

  • pointer to a file on a storage volume
  • more than one name can be associated with the same file
  • supported on UNIX's, Windows NT OS's
  • delete file = decrease link counter
    • counter = 0: delete data

9. rsnapshot

  • Set of perl scripts
  • Calls rsync on regular base (cron)
    • Only changed files transferred
    • Local, remote, ssh,...
  • Creates hardlinks to unchanged files
    • So every run delivers a full snapshot of the complete directory structure
    • Only using diskspace of 1 full system + changes
    • Restore: just copy the files/dirs of the snapshot

10. Practice: /etc/rsnapshot.conf

    • Intervals
      • Interval daily 7
      • Interval weekly 4
    • Exclude files
    • Backup dirs
      • Backup /etc/ localhost/
      • Backup root@leffe:/data leffe/
      • Backup rsync://host/dir/ hostname/
    • Backup scripts
      • backup_script /root/mysqlbackup_leffe.sh leffe/mysqlbackup/

11. My own little setup 12. My own little setup

  • WD MyBook = backup server
  • Daily, weekly, monthly backup
  • Wrapped in WoL script
  • Backup over SSH
    • Secure?Root access?
    • See next slide
  • Backupscripts: MySQL DB and dpkg package list
    • Enables quick recovery of software on ubuntu/linux

13. SSH security

  • Non-interactive, only key-based login without passwords
  • Dedicated key for root
    • In authorized_keys file on client
    • IP-restriction: from="192.168.3.252"
    • Command restriction: command="/root/validatescript"
      • Validatescript returnsoriginal commandorRejected
      • My setup: only rsync server, dpkg get-selections, pm-suspend and db-backup allowed

14. My experiences

  • WD MyBook is a very slow device (CPU)
    • Possible optimisation: let script enable native rsync and disable after backup
  • First backup took some time
  • Daily (incremental) backups are quite fast
  • Watch out for rollback!

15. Conclusion

  • Quite easy and very extensible
  • More info:www.rsnapshot.org
  • more info on hacking WD: http://mybookworld.wikidot.com/

16. Thank you very much! Questions?