diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2010-02-02 04:36:29 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2010-02-02 04:36:29 +0100 |
commit | f6cd196d2eade11a439177072f8b91d78a67fab3 (patch) | |
tree | ade653fdc73d4ccc046c084b5f2dac54e406aac2 | |
parent | c8df07c6e3abcbaecedf457bdfc8dd021eeefed5 (diff) | |
download | backup-f6cd196d2eade11a439177072f8b91d78a67fab3.tar.gz backup-f6cd196d2eade11a439177072f8b91d78a67fab3.tar.xz backup-f6cd196d2eade11a439177072f8b91d78a67fab3.zip |
added replication handling for consistent backups
-rwxr-xr-x | mysql/mysql_backup.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mysql/mysql_backup.sh b/mysql/mysql_backup.sh index 5c73da0..a255314 100755 --- a/mysql/mysql_backup.sh +++ b/mysql/mysql_backup.sh @@ -41,6 +41,10 @@ _check_tools mysqlshow mysqldump ncftpput echo "Started backup of mysql databases ($(date +%c)):" | _log echo | _log +# pause the replication to be able to do consistent backups +echo "STOP SLAVE SQL_THREAD;" | mysql -h${MYSQL_SERVER} -u${MYSQL_USER} \ + -p${MYSQL_PASSWORD} + # create temporary dir mkdir -p ${TMP_DIRECTORY} TMP_DIR=$(mktemp -d --tmpdir=${TMP_DIRECTORY}) @@ -58,6 +62,10 @@ do ${db} | bzip2 -zc > "${BACKUP_PREFIX}_${db}.sql.bz2" done +# restart the replication +echo "START SLAVE SQL_THREAD;" | mysql -h${MYSQL_SERVER} -u${MYSQL_USER} \ + -p${MYSQL_PASSWORD} + # echo created log of file sizes du -sch * | _log echo | _log |