パラメータ追加

This commit is contained in:
野間 2023-07-10 19:44:30 +09:00
parent cf02c61588
commit 59548a1fa4

View File

@ -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コマンドを実行してデータを標準出力に出力