diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_migrate_cluster_remote_flow.py b/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_migrate_cluster_remote_flow.py index cdf19bf034..8f094441ab 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_migrate_cluster_remote_flow.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_migrate_cluster_remote_flow.py @@ -400,6 +400,7 @@ def migrate_cluster_flow(self, use_for_upgrade=False): root_id=self.root_id, parent_global_data=copy.deepcopy(self.data), collect_sysinfo=True, + is_install_backup=False, cluster_type=ClusterType.TenDBHA.value, db_backup_pkg_type=MysqlVersionToDBBackupForMap[self.data["db_version"]], ) diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_restore_slave_flow.py b/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_restore_slave_flow.py index 90645d479f..a7b3d84c88 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_restore_slave_flow.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_restore_slave_flow.py @@ -344,6 +344,7 @@ def deploy_restore_slave_flow(self): root_id=self.root_id, parent_global_data=copy.deepcopy(self.data), collect_sysinfo=True, + is_install_backup=False, cluster_type=ClusterType.TenDBHA.value, ) ) @@ -575,7 +576,7 @@ def deploy_restore_local_slave_flow(self): ) tendb_migrate_pipeline_list.append( - tendb_migrate_pipeline.build_sub_process(_("slave原地重建{}").format(target_slave.machine.ip)) + tendb_migrate_pipeline.build_sub_process(_("slave原地重建{}").format(target_slave.ip_port)) ) tendb_migrate_pipeline_all.add_parallel_sub_pipeline(sub_flow_list=tendb_migrate_pipeline_list) diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_restore_slave_remote_flow.py b/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_restore_slave_remote_flow.py index 934658b304..92d2fa4c1f 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_restore_slave_remote_flow.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/mysql/mysql_restore_slave_remote_flow.py @@ -314,6 +314,7 @@ def tendb_ha_restore_slave_flow(self): master_ip_list=None, slave_ip_list=[self.data["new_slave_ip"]], root_id=self.root_id, + is_install_backup=False, parent_global_data=copy.deepcopy(self.data), cluster_type=ClusterType.TenDBHA.value, ) diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/spider/remote_slave_recover.py b/dbm-ui/backend/flow/engine/bamboo/scene/spider/remote_slave_recover.py index b012e9e508..2a241a9fee 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/spider/remote_slave_recover.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/spider/remote_slave_recover.py @@ -264,6 +264,7 @@ def tendb_remote_slave_recover(self): old_port=node["slave"]["port"], new_ip=node["new_slave"]["ip"], new_port=node["new_slave"]["port"], + server_name=f"SPT_SLAVE{shard_id}", tdbctl_pass=tdbctl_pass, ) switch_slave_class.switch_remote_instance_pairs.append(inst_pairs) diff --git a/dbm-ui/backend/flow/plugins/components/collections/spider/switch_remote_slave_routing.py b/dbm-ui/backend/flow/plugins/components/collections/spider/switch_remote_slave_routing.py index 9ff7f02c15..e42eeb1446 100644 --- a/dbm-ui/backend/flow/plugins/components/collections/spider/switch_remote_slave_routing.py +++ b/dbm-ui/backend/flow/plugins/components/collections/spider/switch_remote_slave_routing.py @@ -43,7 +43,14 @@ def _create_tdbctl_user(self, cluster: Cluster, ctl_primary: str, new_ip: str, n self.log_info(f"add tdbctl user in instance [f'{new_ip}{IP_PORT_DIVIDER}{new_port}'] success") def _alter_remote_slave_routing( - self, cluster: Cluster, old_ip: str, old_port: int, new_ip: str, new_port: int, tdbctl_pass: str + self, + cluster: Cluster, + server_name: str, + old_ip: str, + old_port: int, + new_ip: str, + new_port: int, + tdbctl_pass: str, ): """ 替换实例的路由信息的具体逻辑 @@ -62,7 +69,7 @@ def _alter_remote_slave_routing( "addresses": [ctl_primary], "cmds": [ "set tc_admin=1", - f"select Server_name from mysql.servers where host = '{old_ip}' and port = {old_port}", + f"select Server_name from mysql.servers where Server_name = '{server_name}'", ], "force": False, "bk_cloud_id": cluster.bk_cloud_id, @@ -116,6 +123,7 @@ def _execute(self, data, parent_data): old_port=pairs["old_port"], new_ip=pairs["new_ip"], new_port=pairs["new_port"], + server_name=pairs["server_name"], tdbctl_pass=pairs["tdbctl_pass"], ): return False diff --git a/dbm-ui/backend/flow/utils/spider/spider_act_dataclass.py b/dbm-ui/backend/flow/utils/spider/spider_act_dataclass.py index 1e5bb1c755..c234975b07 100644 --- a/dbm-ui/backend/flow/utils/spider/spider_act_dataclass.py +++ b/dbm-ui/backend/flow/utils/spider/spider_act_dataclass.py @@ -80,6 +80,7 @@ class InstancePairs: new_ip: str old_port: int new_port: int + server_name: str tdbctl_pass: str