Using rsync, and Eva's backup.sh script .
I take database backup every 6 hours and sync to my backup server.
We run a daily backup and prepare at night. Great tool, helped us out a few timesHi,
Start playing with xtrabackup recently and it's an amazing tool.
I'm learning things and would like to know from you how do you manage backups.
Do you make daily full backups (backup + prepare)?
Do you do incremental backup?
Any tool to automate this?
Thanks
Please doIf you want I can share the cron job we built.
#!/bin/bash
bkdate=$(date "+%Y-%m-%d-%H-%M-%S")
bkdir=/opt/backup
innobackupex --no-timestamp ${bkdir}/${bkdate}
innobackupex --use-memory=1G --apply-log ${bkdir}/${bkdate}
for dir in "$( find ${bkdir} -mindepth 1 -maxdepth 1 -type d -mtime +5 )"
do
rm -rf $dir
done
#!/bin/bash
/usr/bin/mysqldump --opt database_name > /path/to/database/backup/folder/database_backup_`date +%d-%m-%Y---%H-%M`.sql
#!/bin/bash
/bin/find /path/to/database/backup/folder -mtime +3 -type f -exec rm -f {} \;
#!/bin/bash
/usr/bin/tar -cf - /path/to/domain/folder | /bin/gzip -c > /path/to/files/backup/folder/files_backup_`date +%d-%m-%Y---%H-%M`.tar.gz
#!/bin/bash
/bin/find /path/to/files/backup/folder -mmin +10 -type f -exec rm -f {} \;
Here: https://community.centminmod.com/th...-database-backups-for-centmin-mod-stack.4573/Would you like to point to that backup script?
Thanks
Personally not much a fan of incremental backups as the only method of backup. As incrementals are only as good as the last known good full snapshot backup. Without that last full working snapshot backup, those incremental backups are usually useless.Yes, it's a great tool, so no one makes incremental with xtrabackup?
Yes I wrote and use dbbackup.sh (mysqldump based) or an advanced variation of it myself to backup databases every 4, 6 or 8hrs to local disk + amazon s3 + with rsnapshot on remote server pull backups every 4hrs, 24hrs, weekly and monthly. Also multi-threaded compression support means faster compressed backup routines. dbbackup.sh can automatically detect if a database uses innodb or myisam tables and dynamically adjust the mysqldump options to optimally backup innodb or myisam based databases. The script also backups databases in ascending order of size. So smallest databases are backed up first so you have the greatest chance of backing up the most data if you run into problems due to resources or network connectivity issues and aborted backup processes
#!/bin/sh
# Database Backup script
username=xxxxxx
password=xxxxxxx
now=`date +"%Y-%m-%d_%H-%M"`
# First: Remove old backups
find /path/to/db/db.* -type f -mmin +1200 -delete
# Create the Backup
export PATH=$PATH:/path/to/xtrabackup
innobackupex --slave-info --user=$username --password=$password --no-timestamp /path/to/backupdir/db.$now 1>/path/to/backupdir/db.$now.log 2>&1
success=`grep -c "completed OK" /path/to/backupdir/db.$now.log`
# Prepare the Backup
if [ "$success" -eq "2" ]
then
innobackupex --apply-log /path/to/backupdir/db.$now 1>>/path/to/backupdir/db.$now.log 2>&1
fi
success=`grep -c "completed OK" /path/to/backupdir/db.$now.log`
# Mail on Error
if [ "$success" -ne "4" ]
then
echo "Subject: Database Backup Failure $now" > /path/to/backupdir/mailoutput
cat /path/to/backupdir/db.$now.log >> /path/to/backupdir/mailoutput
/usr/sbin/sendmail you@mail.com < /backup/mailoutput
rm -f /path/to/backupdir/mailoutput
fi
We use essential cookies to make this site work, and optional cookies to enhance your experience.