Skip to content

Commit

Permalink
fix(redis): tendisplus容量变更、predixy自愈bug修复 TencentBlueKing#6829
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemakeit authored and zhangzhw8 committed Sep 12, 2024
1 parent 274fa56 commit 8d329a8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down

0 comments on commit 8d329a8

Please sign in to comment.