From 59548a1fa4392ba99b4e721697552b79e64c63a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=8E=E9=96=93?= Date: Mon, 10 Jul 2023 19:44:30 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ecs/jskult-dbdump/src/jobctrl_dbdump.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/ecs/jskult-dbdump/src/jobctrl_dbdump.py b/ecs/jskult-dbdump/src/jobctrl_dbdump.py index 42be4e51..477a1388 100644 --- a/ecs/jskult-dbdump/src/jobctrl_dbdump.py +++ b/ecs/jskult-dbdump/src/jobctrl_dbdump.py @@ -57,23 +57,6 @@ def exec(): with open(my_cnf_path, 'w') as f: f.write(textwrap.dedent(my_cnf_file_content)[1:-1]) - #*************************************************************** - # # MySQLコマンドを実行する - # command = ['mysqldump', f'--defaults-file={my_cnf_path}', '-P', f"'{environment.DB_PORT}'", environment.DB_SCHEMA] - # mysqldump_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # # gzipコマンドを実行して圧縮する - # gzip_process = subprocess.Popen(['gzip'], stdin=mysqldump_process.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - # # aws s3 cpコマンドを実行してアップロードする - # s3_cp_process = subprocess.Popen(['aws', 's3', 'cp', '-', s3_file_name], stdin=gzip_process.stdout ,stderr=subprocess.PIPE) - # # 出力を取得する - # mysqldump_process.stdout.close() - # _, error = s3_cp_process.communicate() - - # if s3_cp_process.returncode != 0: - # print("Error: ", error.decode("utf-8")) - # raise Exception('Error') - #*************************************************************** - dt_now = datetime.datetime.now() converted_value = dt_now.strftime('%Y%m%d%H%M%S') file_name = f'backup_rds_src05_{converted_value}.gz' @@ -85,6 +68,10 @@ def exec(): '--password={db_pw}'.format(db_pw=environment.DB_PASSWORD), '--host={db_host}'.format(db_host=environment.DB_HOST), '--port={db_port}'.format(db_port=environment.DB_PORT), + '--no-tablespaces', + '--skip-column-statistics', + '--single-transaction', + '--set-gtid-purged=OFF', '{db_name}'.format(db_name=environment.DB_SCHEMA) ] # mysqldumpコマンドを実行してデータを標準出力に出力