From 2a7ad73a74c5caf2b9a1f945abe3d12d3e3972df Mon Sep 17 00:00:00 2001 From: xiepaup Date: Thu, 14 Dec 2023 11:23:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(redis):=20=E6=95=B4=E6=9C=BA=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=20=20#2577?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bamboo/scene/redis/atom_jobs/redis_cluster_master_rep.py | 5 ++--- .../flow/engine/bamboo/scene/redis/atom_jobs/redis_switch.py | 3 --- dbm-ui/backend/flow/utils/redis/redis_act_playload.py | 5 +++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/redis_cluster_master_rep.py b/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/redis_cluster_master_rep.py index eb3b717d5c..c269ea5577 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/redis_cluster_master_rep.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/redis_cluster_master_rep.py @@ -80,8 +80,7 @@ def TwemproxyClusterMasterReplaceJob( for replace_link in master_replace_detail: old_master_ip = replace_link["ip"] old_slave_ip = act_kwargs.cluster["master_slave_map"][old_master_ip] - new_master_ip = replace_link["target"]["master"]["ip"] - new_slave_ip = replace_link["target"]["slave"]["ip"] + new_master_ip, new_slave_ip = replace_link["target"]["master"]["ip"], replace_link["target"]["slave"]["ip"] new_ins_port = DEFAULT_REDIS_START_PORT old_ports = act_kwargs.cluster["master_ports"][old_master_ip] @@ -107,7 +106,7 @@ def TwemproxyClusterMasterReplaceJob( new_ins_port += 1 twemproxy_server_shards = get_twemproxy_cluster_server_shards( - act_kwargs.cluster["bk_biz_id"], act_kwargs.cluster["cluster_id"], act_kwargs.cluster["slave_ins_map"] + act_kwargs.cluster["bk_biz_id"], act_kwargs.cluster["cluster_id"], new_instances_to_master ) # ## 部署实例 ############################################################################# diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/redis_switch.py b/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/redis_switch.py index 0ee9ce3164..2a1fd9b435 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/redis_switch.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/redis_switch.py @@ -123,9 +123,6 @@ def RedisClusterSwitchAtomJob(root_id, data, act_kwargs: ActKwargs, sync_params: ClusterType.TwemproxyTendisSSDInstance, ClusterType.TendisTwemproxyRedisInstance, ]: - act_kwargs.cluster["instances"] = nosqlcomm.other.get_cluster_proxies( - cluster_id=act_kwargs.cluster["cluster_id"] - ) act_kwargs.get_redis_payload_func = RedisActPayload.redis_twemproxy_backends_4_scene.__name__ sub_pipeline.add_act( act_name=_("Redis-{}-检查切换状态").format(exec_ip), diff --git a/dbm-ui/backend/flow/utils/redis/redis_act_playload.py b/dbm-ui/backend/flow/utils/redis/redis_act_playload.py index d9ae18bd21..863585d7fa 100644 --- a/dbm-ui/backend/flow/utils/redis/redis_act_playload.py +++ b/dbm-ui/backend/flow/utils/redis/redis_act_playload.py @@ -1142,11 +1142,12 @@ def redis_checksync_4_scene(self, **kwargs) -> dict: # 检测 proxy 后端一致性 def redis_twemproxy_backends_4_scene(self, **kwargs) -> dict: params = kwargs["params"] - + # 需要实时拿 + instances = nosqlcomm.other.get_cluster_proxies(cluster_id=params["cluster_id"]) return { "db_type": DBActuatorTypeEnum.Proxy.value, "action": DBActuatorTypeEnum.Twemproxy.value + "_" + RedisActuatorActionEnum.CheckProxysMd5.value, - "payload": {"instances": params["instances"], "cluster_type": params["cluster_type"]}, + "payload": {"instances": instances, "cluster_type": params["cluster_type"]}, } # twemproxy 架构-实例切换