Skip to content

Commit

Permalink
style: 数据恢复涉及下载节点打印备份信息 TencentBlueKing#8059
Browse files Browse the repository at this point in the history
  • Loading branch information
zfrendo committed Nov 20, 2024
1 parent 481f440 commit b1c57ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def tendb_remote_slave_local_recover(self):
)

exec_act_kwargs.get_mysql_payload_func = MysqlActPayload.mysql_change_server_id.__name__
tendb_migrate_pipeline.add_act(
sync_data_sub_pipeline.add_act(
act_name=_("重置server_id {}".format(exec_act_kwargs.exec_ip)),
act_component_code=ExecuteDBActuatorScriptComponent.code,
kwargs=asdict(exec_act_kwargs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def _execute(self, data, parent_data) -> bool:
"login_passwd": kwargs["login_passwd"],
}
self.log_debug(params)
self.log_info(_("下载 {} 到 {}").format(kwargs["task_ids"], kwargs["dest_ip"]))
response = MysqlBackupApi.download(params=params)
backup_bill_id = response.get("bill_id", -1)
if backup_bill_id > 0:
Expand Down
7 changes: 7 additions & 0 deletions dbm-ui/backend/flow/utils/mysql/mysql_act_playload.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@ def get_rollback_data_restore_payload(self, **kwargs):
"""
MYSQL 定点回档恢复备份介质
"""
logger.info(self.cluster["backupinfo"])
init_command = self.cluster.get("init_command", "")
enable_binlog = self.cluster.get("enable_binlog", False)
index_file = os.path.basename(self.cluster["backupinfo"]["index"]["file_name"])
Expand Down Expand Up @@ -2028,6 +2029,7 @@ def tendb_restore_remotedb_payload(self, **kwargs):
"""
tendb 恢复remote实例
"""
logger.info(self.cluster["backupinfo"])
index_file = os.path.basename(self.cluster["backupinfo"]["index"]["file_name"])
payload = {
"db_type": DBActuatorTypeEnum.MySQL.value,
Expand Down Expand Up @@ -2088,6 +2090,7 @@ def tendb_remotedb_change_master(self, **kwargs) -> dict:
bin_file = kwargs["trans_data"]["change_master_info"]["master_log_file"]
bin_position = int(kwargs["trans_data"]["change_master_info"]["master_log_pos"])
bin_file = bin_file.strip().strip("'")
logger.info("CHANGE MASTER TO MASTER_LOG_FILE='{}', MASTER_LOG_POS={}".format(bin_file, bin_position))
return {
"db_type": DBActuatorTypeEnum.MySQL.value,
"action": DBActuatorActionEnum.ChangeMaster.value,
Expand All @@ -2111,6 +2114,10 @@ def tendb_recover_binlog_payload(self, **kwargs):
"""
MYSQL 实例 前滚binglog
"""
logger.info(self.cluster["binlog_files"])
logger.info(
"backup_time: {} ~ stop_time: {} ".format(self.cluster["backup_time"], self.cluster["rollback_time"])
)
binlog_files = self.cluster["binlog_files"]
backup_time = self.cluster["backup_time"]
binlog_files_list = binlog_files.split(",")
Expand Down

0 comments on commit b1c57ba

Please sign in to comment.