Skip to content

Commit

Permalink
style: tendbHa数据恢复流程代码优化代码 #6973
Browse files Browse the repository at this point in the history
  • Loading branch information
zfrendo committed Sep 19, 2024
1 parent b130838 commit 7eba6d5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ def slave_migrate_switch_sub_flow(
)
),
)
return sub_pipeline.build_sub_process(sub_name=_("[{}]成对切换".format(cluster.name)))
return sub_pipeline.build_sub_process(sub_name=_("{}切换到新从库{}:{}".format(cluster.name, new_slave_ip, master.port)))
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@
from backend.flow.plugins.components.collections.common.pause import PauseComponent
from backend.flow.plugins.components.collections.mysql.clear_machine import MySQLClearMachineComponent
from backend.flow.plugins.components.collections.mysql.exec_actuator_script import ExecuteDBActuatorScriptComponent
from backend.flow.plugins.components.collections.mysql.mysql_crond_control import MysqlCrondMonitorControlComponent
from backend.flow.plugins.components.collections.mysql.mysql_db_meta import MySQLDBMetaComponent
from backend.flow.plugins.components.collections.mysql.trans_flies import TransFileComponent
from backend.flow.utils.common_act_dataclass import DownloadBackupClientKwargs
from backend.flow.utils.mysql.common.mysql_cluster_info import get_ports, get_version_and_charset
from backend.flow.utils.mysql.mysql_act_dataclass import (
ClearMachineKwargs,
CrondMonitorKwargs,
DBMetaOPKwargs,
DownloadMediaKwargs,
ExecActuatorKwargs,
Expand Down Expand Up @@ -439,18 +437,18 @@ def migrate_cluster_flow(self, use_for_upgrade=False):
db_backup_pkg_type=MysqlVersionToDBBackupForMap[self.data["db_version"]],
)
)
tendb_migrate_pipeline.add_act(
act_name=_("屏蔽监控 {} {}").format(self.data["new_master_ip"], self.data["new_slave_ip"]),
act_component_code=MysqlCrondMonitorControlComponent.code,
kwargs=asdict(
CrondMonitorKwargs(
bk_cloud_id=cluster_class.bk_cloud_id,
exec_ips=[self.data["new_master_ip"], self.data["new_slave_ip"]],
port=0,
minutes=240,
)
),
)
# tendb_migrate_pipeline.add_act(
# act_name=_("屏蔽监控 {} {}").format(self.data["new_master_ip"], self.data["new_slave_ip"]),
# act_component_code=MysqlCrondMonitorControlComponent.code,
# kwargs=asdict(
# CrondMonitorKwargs(
# bk_cloud_id=cluster_class.bk_cloud_id,
# exec_ips=[self.data["new_master_ip"], self.data["new_slave_ip"]],
# port=0,
# minutes=240,
# )
# ),
# )
# 人工确认切换迁移实例
tendb_migrate_pipeline.add_act(act_name=_("人工确认切换"), act_component_code=PauseComponent.code, kwargs={})
# 切换迁移实例
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,18 +350,18 @@ def tendb_ha_restore_slave_flow(self):
cluster_type=ClusterType.TenDBHA.value,
)
)
tendb_migrate_pipeline.add_act(
act_name=_("屏蔽监控 {}").format(self.data["new_slave_ip"]),
act_component_code=MysqlCrondMonitorControlComponent.code,
kwargs=asdict(
CrondMonitorKwargs(
bk_cloud_id=cluster_class.bk_cloud_id,
exec_ips=[self.data["new_slave_ip"]],
port=0,
minutes=240,
)
),
)
# tendb_migrate_pipeline.add_act(
# act_name=_("屏蔽监控 {}").format(self.data["new_slave_ip"]),
# act_component_code=MysqlCrondMonitorControlComponent.code,
# kwargs=asdict(
# CrondMonitorKwargs(
# bk_cloud_id=cluster_class.bk_cloud_id,
# exec_ips=[self.data["new_slave_ip"]],
# port=0,
# minutes=240,
# )
# ),
# )

if not self.add_slave_only:
# 人工确认切换迁移实例
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def _execute(self, data, parent_data) -> bool:
cmd_str += " enable-job"
else:
cmd_str += " pause-job -r {}m".format(kwargs["minutes"])
if kwargs["port"] != 0:
if kwargs["port"] == 0:
cmd_str += " --name-match mysql-monitor-.*"
else:
cmd_str += " --name-match mysql-monitor-{}-.*".format(kwargs["port"])
if kwargs["name"] != "":
cmd_str += " --name {}".format(kwargs["name"])
Expand Down

0 comments on commit 7eba6d5

Please sign in to comment.