Mysqldump backups with binlog file and position
I've been using mysqldump database backups for a long time. To make it easier to restore replicated systems, here's some bash code to capture the current binlog filename and position. There will be a bit of time between when the position number is captured and when the backup starts. Do you have any recommendations for improvements?
binlogFile=`mysql $usrpwd -e 'show master status\G' | grep File | cut -d':' -f 2 | tr -d ' '`
binlogPosition=`mysql $usrpwd -e 'show master status\G' | grep Position | cut -d':' -f 2 | tr -d ' '`
backupFile="$databaseName"_"`date +%Y-%m-%d_%Hh%Mm`"_"$binlogFile"_"$binlogPosition.sql.gz"
echo "Binlog file: $binlogFile"
echo "Binlog position: $binlogPosition"
echo "Backup file: $backupFile"
mysqldump $userpwd -R --single-transaction --quick $databaseName | gzip > $backupFile
Subject
Written By
Posted
Mysqldump backups with binlog file and position
May 08, 2014 08:44AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.