Skip to content

Commit

Permalink
fix(redis): 整机替换优化 #2628
Browse files Browse the repository at this point in the history
  • Loading branch information
xiepaup authored and zhangzhw8 committed Dec 15, 2023
1 parent 825d03b commit 0dfab13
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,18 @@ def get_cluster_info(bk_biz_id: int, cluster_id: int) -> dict:
else:
slave_master_map[slave_obj.machine.ip] = master_obj.machine.ip

cluster_info = api.cluster.nosqlcomm.other.get_cluster_detail(cluster_id)[0]
cluster_name = cluster_info["name"]
cluster_type = cluster_info["cluster_type"]
redis_master_set = cluster_info["redis_master_set"]
redis_slave_set = cluster_info["redis_slave_set"]
servers = []
if cluster_type in [ClusterType.TendisTwemproxyRedisInstance, ClusterType.TwemproxyTendisSSDInstance]:
for set in redis_master_set:
ip_port, seg_range = str.split(set)
servers.append("{} {} {} {}".format(ip_port, cluster_name, seg_range, 1))
else:
servers = redis_master_set + redis_slave_set
cluster_info = api.cluster.nosqlcomm.other.get_cluster_detail(cluster_id)[0]
redis_master_set, redis_slave_set, servers = (
cluster_info["redis_master_set"],
cluster_info["redis_slave_set"],
[],
)
if cluster.cluster_type in [ClusterType.TendisTwemproxyRedisInstance, ClusterType.TwemproxyTendisSSDInstance]:
for set in redis_master_set:
ip_port, seg_range = str.split(set)
servers.append("{} {} {} {}".format(ip_port, cluster.name, seg_range, 1))
else:
servers = redis_master_set + redis_slave_set

return {
"immute_domain": cluster.immute_domain,
Expand Down

0 comments on commit 0dfab13

Please sign in to comment.