Tag: mysql

Backing up MySQL database

Backup using innobackupex This script backups your database and uploads it to Amazon S3: #!/bin/bash timestamp=`date “+%Y-%m-%d_%H-%M-%S”` innobackupex –user=[username] –password=[password] –parallel=3 –safe-slave-backup –slave-info –no-timestamp /data/backup/${timestamp}_slave innobackupex –user=[username] –password=[password] –apply-log /data/backup/${timestamp}_slave/ tar czf /data/backup/${timestamp}_slave.tgz /data/backup/${timestamp}_slave /usr/local/bin/aws –region [region] s3 cp /data/backup/${timestamp}_slave.tgz s3://[bucket]/[backup-path]/`date “+%Y”`/`date “+%m”`/`date “+%d”`/ rm -rf /data/backup/${timestamp}_slave rm -f /data/backup/${timestamp}_slave.tgz You can easily write this script in backup.sh and schedule a cronjob...