Skip to content

Commit

Permalink
fix(redis): 整机替换 #2577
Browse files Browse the repository at this point in the history
  • Loading branch information
xiepaup authored and zhangzhw8 committed Dec 14, 2023
1 parent b3c08f8 commit 2a7ad73
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
)

# ## 部署实例 #############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 3 additions & 2 deletions dbm-ui/backend/flow/utils/redis/redis_act_playload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 架构-实例切换
Expand Down

0 comments on commit 2a7ad73

Please sign in to comment.