12. #!/bin/bash
mysqldump -u web --password=j03r0cks!
-h userdb.corp.com users | gzip > $BACKUPFILE
if [ $? -ne 0 ]; then
backupalert.sh "ALERT: Failure while backing
up userdb!!"
else
writelog.sh "User DB Backup Complete!"
fi
13. #!/bin/bash
mysqldump -u web --password=j03r0cks!
-h userdb.corp.com users | gzip > $BACKUPFILE
if [ $? -ne 0 ]; then
backupalert.sh "ALERT: Failure while backing
up userdb!!"
else
writelog.sh "User DB Backup Complete!"
fi
14.
15.
16.
17.
18.
19.
20.
21.
22. A few little facts...
• XBM for short (cmd line tool)
• Written in PHP5 (Object Oriented)
• Leverages cron, netcat and ssh
• Works on Linux and Solaris
• GPLv2
25. What you’ll need...
• Server with plenty of storage
space (management server)
– MySQL 5.x+
– PHP 5.1.6+ (CLI)
• mysql or root access to the servers
• XtraBackup 1.6.4+
26. Installing...
• Create UNIX user for XBM
• Create MySQL user for XBM +
Schema
• Download latest tarball
• Extract to xbm user homedir
• Initialize the XBM schema:
mysql xbm < ./sql/schema_init.sql
27. Setup SSH Trust...
XBM user must be able to SSH without
password:
shell> ssh mysql@dbhost
28. Install
XtraBackup...
• Download & Install XtraBackup
1.6.4+
• Install on both backup server and
DB hosts
• Ensure XtraBackup is in $PATH too
29.
30. ./xbm
./xbm backup list
./xbm volume add "mybackupdir" /home/xbm/backups/
./xbm volume list
./xbm host add localhost Just-testing
./xbm host list
./xbm backup add localhost monthlyBackup FULLONLY "30 03 01 * *" mybackupdir /var/lib/mysql
root root
./xbm backup list
./xbm backup run localhost monthlyBackup
./xbm snapshot list localhost
ls ../backups/
ls ../backups/localhost
ls ../backups/localhost/*
31.
32. Backup Strategies?
• When do I take full backups?
• When should I take incremental
backups?
• How many snapshots do I keep?
• ... etc.
46. What is missing?
• 1.0 release
• pitr (copy binlogs)
• compression
• encryption
• progress indicator
• GUI
47. Meh... Any alternatives?
• Zmanda Recovery Manager (ZRM)
• Used to be open source in 2006
• Still there, does support
xtrabackup (and everything else)
• GUI, a bell and 3 whistles included!
48. Try it out!
Google Code:
http://code.google.com/p/xtrabackup-
manager
MySQL Soapbox - (My Blog)
http://mysqlsoapbox.blogspot.com