From 5d232b40174ba25b2ee5f98f5f970cca3d0729da Mon Sep 17 00:00:00 2001 From: yuanruji Date: Mon, 18 Nov 2024 11:04:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(backend):=20=E8=BF=BD=E5=8A=A0=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E4=B8=AD=E6=8E=A7=E6=97=B6,=E4=BA=92=E7=9B=B8?= =?UTF-8?q?=E6=8E=88=E6=9D=83repl=20#8001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scene/spider/append_deploy_ctl_flow.py | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/spider/append_deploy_ctl_flow.py b/dbm-ui/backend/flow/engine/bamboo/scene/spider/append_deploy_ctl_flow.py index 4176af4024..bb950d278b 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/spider/append_deploy_ctl_flow.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/spider/append_deploy_ctl_flow.py @@ -22,19 +22,21 @@ from backend.db_meta.enums import ClusterType, InstanceInnerRole, TenDBClusterSpiderRole from backend.db_meta.exceptions import ClusterNotExistException from backend.db_meta.models import Cluster, StorageInstance -from backend.flow.consts import LONG_JOB_TIMEOUT +from backend.flow.consts import LONG_JOB_TIMEOUT, PrivRole from backend.flow.engine.bamboo.scene.common.builder import Builder, SubBuilder from backend.flow.engine.bamboo.scene.common.get_file_list import GetFileList -from backend.flow.engine.bamboo.scene.spider.common.common_sub_flow import build_ctl_replication_with_gtid from backend.flow.plugins.components.collections.mysql.exec_actuator_script import ExecuteDBActuatorScriptComponent +from backend.flow.plugins.components.collections.mysql.sync_master import SyncMasterComponent from backend.flow.plugins.components.collections.mysql.trans_flies import TransFileComponent from backend.flow.plugins.components.collections.spider.add_system_user_in_cluster import ( AddSystemUserInClusterComponent, ) +from backend.flow.utils.base.base_dataclass import Instance from backend.flow.utils.mysql.mysql_act_dataclass import ( AddSpiderSystemUserKwargs, DownloadMediaKwargs, ExecActuatorKwargs, + MysqlSyncMasterKwargs, ) from backend.flow.utils.mysql.mysql_act_playload import MysqlActPayload @@ -329,14 +331,20 @@ def run(self): migrate_pipeline.add_parallel_acts(acts_list=acts_list) # 构建spider中控集群 - migrate_pipeline.add_sub_pipeline( - sub_flow=build_ctl_replication_with_gtid( - root_id=self.root_id, - parent_global_data=self.data, - bk_cloud_id=int(self.data["bk_cloud_id"]), - ctl_primary=f"{primary_ctl_ip}{IP_PORT_DIVIDER}{ctl_port}", - ctl_secondary_list=[{"ip": value} for value in slave_ctp_ips], - ) + migrate_pipeline.add_act( + act_name=_("构建spider中控集群同步"), + act_component_code=SyncMasterComponent.code, + kwargs=asdict( + MysqlSyncMasterKwargs( + bk_biz_id=int(self.data["bk_biz_id"]), + bk_cloud_id=int(self.data["bk_cloud_id"]), + priv_role=PrivRole.TDBCTL.value, + master=Instance(host=primary_ctl_ip, port=ctl_port), + slaves=[Instance(host=slave_ip, port=ctl_port) for slave_ip in slave_ctp_ips], + is_gtid=True, + is_add_any=True, + ) + ), ) # 内部集群节点之间授权 migrate_pipeline.add_act(