Skip to content

Commit 3167cd2

Browse files
OMG-ByiSecloud
authored andcommitted
fix(redis): 修复dts分片变更bug TencentBlueKing#8670
1 parent 5e15b3d commit 3167cd2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

dbm-services/redis/db-tools/dbactuator/pkg/atomjobs/atomredis/redis_dts_online_switch.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ func (job *RedisDtsOnlineSwitch) NewProxyConfigFileForSameType() (err error) {
361361
dstConfContent = strings.ReplaceAll(dstConfContent, logRootDir+"/", consts.GetRedisDataDir()+"/")
362362
}
363363
}
364+
// 避免跟密码字段有重复,放在最后面替换集群名
365+
dstConfContent = strings.ReplaceAll(dstConfContent, job.params.DstClusterName, job.params.SrcClusterName)
364366

365367
newFile := fmt.Sprintf("dts_new_config.billid_%d.%s_%d.%s", job.params.DtsBillID, job.params.SrcProxyIP,
366368
job.params.SrcProxyPort, job.getSrcConfigFileSuffix())
@@ -392,6 +394,10 @@ func (job *RedisDtsOnlineSwitch) NewProxyConfigFileForSameType() (err error) {
392394
if err != nil {
393395
return
394396
}
397+
398+
// 修改目录归属
399+
util.LocalDirChownMysql(job.getSrcProxyConfigSaveDir())
400+
395401
return nil
396402
}
397403

@@ -418,6 +424,8 @@ func (job *RedisDtsOnlineSwitch) NewProxyConfigFileForDiffType() (err error) {
418424
dstConfContent = strings.ReplaceAll(dstConfContent, logRootDir+"/", consts.GetRedisDataDir()+"/")
419425
}
420426
}
427+
// 避免跟密码字段有重复,放在最后面替换集群名
428+
dstConfContent = strings.ReplaceAll(dstConfContent, job.params.DstClusterName, job.params.SrcClusterName)
421429

422430
proxyFileForDstPort := job.getProxyFile(job.params.DstClusterType, job.params.DstProxyPort)
423431
proxyFileForDstPort = filepath.Join(saveDirForDstPort, proxyFileForDstPort)

0 commit comments

Comments
 (0)