From 8d329a81854e83c427f83c7c4956bea4130e561d Mon Sep 17 00:00:00 2001 From: lukemakeit <2302063437@qq.com> Date: Wed, 11 Sep 2024 00:36:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(redis):=20tendisplus=E5=AE=B9=E9=87=8F?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E3=80=81predixy=E8=87=AA=E6=84=88bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20#6829?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../predixy_config_servers_rewrite.go | 2 +- .../atomredis/clustermeet_slotsassign.go | 37 ++++++++++++------- .../scene/redis/atom_jobs/proxy_install.py | 5 ++- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomproxy/predixy_config_servers_rewrite.go b/dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomproxy/predixy_config_servers_rewrite.go index 294edf07b1..ff490f61eb 100644 --- a/dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomproxy/predixy_config_servers_rewrite.go +++ b/dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomproxy/predixy_config_servers_rewrite.go @@ -80,7 +80,7 @@ func (job *PredixyConfServersRewrite) Run() (err error) { var password string password, err = myredis.GetPredixyAdminPasswdFromConfFlie(job.params.PredixyPort) if err != nil { - return nil + return } err = job.newConn(password) if err != nil { diff --git a/dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomredis/clustermeet_slotsassign.go b/dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomredis/clustermeet_slotsassign.go index 0d4d6e14a3..d2db872832 100644 --- a/dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomredis/clustermeet_slotsassign.go +++ b/dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomredis/clustermeet_slotsassign.go @@ -179,24 +179,35 @@ func (job *ClusterMeetSlotsAssign) AddInstsToCluster() (err error) { firstIP := job.params.ReplicaPairs[0].MasterIP firstPort := job.params.ReplicaPairs[0].MasterPort firstCli := job.AddrMapCli[firstAddr] - addrMap, err := firstCli.GetAddrMapToNodes() - if err != nil { - return - } - for add01, cli := range job.AddrMapCli { - if add01 == firstAddr { + var addrMap map[string]*myredis.ClusterNodeData + maxRetryTimes := 5 + for maxRetryTimes >= 0 { + maxRetryTimes-- + isAllNodesKnown := true // 是否所有节点都被firstNode认识 + addrMap, err = firstCli.GetAddrMapToNodes() + if err != nil { continue } - node01, ok := addrMap[add01] - if ok && myredis.IsRunningNode(node01) { - continue + for add01, cli := range job.AddrMapCli { + if add01 == firstAddr { + continue + } + node01, ok := addrMap[add01] + if ok && myredis.IsRunningNode(node01) { + continue + } + isAllNodesKnown = false // 存在节点未被firstNode认识 + job.runtime.Logger.Info("redis(%s) cluster meet %s:%d", cli.Addr, firstIP, firstPort) + _, err = cli.ClusterMeet(firstIP, strconv.Itoa(firstPort)) + if err != nil { + return + } } - _, err = cli.ClusterMeet(firstIP, strconv.Itoa(firstPort)) - if err != nil { - return + if isAllNodesKnown { + break } + time.Sleep(10 * time.Second) } - time.Sleep(10 * time.Second) job.runtime.Logger.Info("all redis instances add to cluster") return nil } diff --git a/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/proxy_install.py b/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/proxy_install.py index 0929fc7f82..adb08629db 100644 --- a/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/proxy_install.py +++ b/dbm-ui/backend/flow/engine/bamboo/scene/redis/atom_jobs/proxy_install.py @@ -124,7 +124,10 @@ def ProxyBatchInstallAtomJob( act_kwargs.cluster["dbconfig"] = param["conf_configs"] # 从dbconfig中获取load_modules cluster = Cluster.objects.get(immute_domain=act_kwargs.cluster["immute_domain"]) - load_modules = get_cluster_redis_modules_detial(cluster_id=cluster.id) + load_modules = [] + module_rows = get_cluster_redis_modules_detial(cluster_id=cluster.id) + for module_row in module_rows: + load_modules.append(module_row["module_name"]) # 安装proxy实例 if act_kwargs.cluster["cluster_type"] in [