Use --single-transaction for mysqldump
InnoDB is an MVCC storage engine. This means it does not need to lock tables in order to do a consistent read of data. Add --single-transaction to mysqldump invocations to enable this behavior and stop locking the tables. Downsides to this - changes made to MyISAM tables may not be consistent (but for the love of all that is holy we should be storing nothing in MyISAM and neither should anyone else) and DDL commands will not be allowed during the backup. Change-Id: If2ea9e5a25a3cfe30c16cc646463afbd3b2a5ab5
This commit is contained in:
parent
ec9649b4da
commit
320fe64ba8
@ -37,7 +37,7 @@ define mysql_backup::backup (
|
||||
|
||||
cron { "${name}-backup":
|
||||
ensure => present,
|
||||
command => "/usr/bin/mysqldump --defaults-file=${defaults_file} --opt --ignore-table mysql.event --all-databases | gzip -9 > ${dest_dir}/${name}.sql.gz",
|
||||
command => "/usr/bin/mysqldump --defaults-file=${defaults_file} --opt --ignore-table mysql.event --all-databases --single-transaction | gzip -9 > ${dest_dir}/${name}.sql.gz",
|
||||
minute => $minute,
|
||||
hour => $hour,
|
||||
weekday => $day,
|
||||
|
@ -47,7 +47,7 @@ define mysql_backup::backup_remote (
|
||||
|
||||
cron { "${name}-backup":
|
||||
ensure => present,
|
||||
command => "/usr/bin/mysqldump --defaults-file=${defaults_file} --opt --ignore-table mysql.event --all-databases | gzip -9 > ${dest_dir}/${name}.sql.gz",
|
||||
command => "/usr/bin/mysqldump --defaults-file=${defaults_file} --opt --ignore-table mysql.event --all-databases --single-transaction | gzip -9 > ${dest_dir}/${name}.sql.gz",
|
||||
minute => $minute,
|
||||
hour => $hour,
|
||||
weekday => $day,
|
||||
|
Loading…
Reference in New Issue
Block a user