From f0c4f21f5d405b46e8c6cfef3c034a0634963702 Mon Sep 17 00:00:00 2001 From: Bekir Pehlivan Date: Wed, 14 Feb 2024 15:19:19 +0300 Subject: [PATCH] Added flags to mysqldump for performance --- backup/mysql.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backup/mysql.go b/backup/mysql.go index aebb15a..2dca9ee 100644 --- a/backup/mysql.go +++ b/backup/mysql.go @@ -51,15 +51,17 @@ func dumpMySQLDb(db string, dst string, params config.Params, logger Logger) (st var mysqlArgs []string if params.Remote.IsRemote { - mysqlArgs = append(mysqlArgs, "-h"+params.Remote.Host, "--port="+params.Remote.Port, "-u"+params.Remote.User, "-p"+params.Remote.Password, db) + mysqlArgs = append(mysqlArgs, "-h"+params.Remote.Host, "--port="+params.Remote.Port, "-u"+params.Remote.User, "-p"+params.Remote.Password) } else { - mysqlArgs = append(mysqlArgs, "-u"+params.Remote.User, "-p"+params.Remote.Password, db) + mysqlArgs = append(mysqlArgs, "-u"+params.Remote.User, "-p"+params.Remote.Password) } date := rightNow{ year: time.Now().Format("2006"), month: time.Now().Format("01"), } + mysqlArgs = append(mysqlArgs, "--single-transaction", "--quick", "--skip-lock-tables", "--routines", "--triggers", db) + if db == "mysql" { mysqlArgs = append(mysqlArgs, "user") name = dumpName(db+"_users", params.Rotation)