Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(redis): 重建slave时,需关闭disk-delete-count #8995 #9002

Open
wants to merge 1 commit into
base: v1.5.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,9 @@ func (task *BackupTask) TendisSSDInstanceBackup() {
return
}

afterVerify, _ := task.Cli.TendisSSDBinlogSize()
mylog.Logger.Info("fish backup with binlogPos: %+v; afterVerify binlogPos: %+v", binlogsizeRet, afterVerify)

// 备份文件名带上 binlogPos
fileWithBinlogPos := fmt.Sprintf("%s-%d", backupFullDir, binlogsizeRet.EndSeq)
task.Err = os.Rename(backupFullDir, fileWithBinlogPos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,11 @@ export LD_LIBRARY_PATH=LD_LIBRARY_PATH:%s
task.runtime.Logger.Info(sedCmd)
util.RunBashCmd(sedCmd, "", nil, 1*time.Minute)

// 先注释掉slaveof命令, 拉起后不要 清理过期数据
sedCmd = fmt.Sprintf("sed -i -e 's/^disk-delete-count [0-9]*/disk-delete-count 0/g' %s", slaveConfFile)
task.runtime.Logger.Info(sedCmd)
util.RunBashCmd(sedCmd, "", nil, 1*time.Minute)

startScript := filepath.Join("/usr/local/redis/bin", "start-redis.sh")
_, task.Err = util.RunLocalCmd("su", []string{consts.MysqlAaccount, "-c", startScript + " " + strconv.Itoa(
task.SlavePort)}, "", nil, 10*time.Second)
Expand Down Expand Up @@ -549,13 +554,18 @@ export LD_LIBRARY_PATH=LD_LIBRARY_PATH:%s
return
}

slaveBinlogRange2, _ := task.SlaveCli.TendisSSDBinlogSize()
task.runtime.Logger.Info("binlogPos AtStart:%+v, AfterSetSnapShot:%+v", slaveBinlogRange, slaveBinlogRange2)

// slaveof
_, task.Err = task.SlaveCli.SlaveOf(task.MasterIP, strconv.Itoa(task.MasterPort))
if task.Err != nil {
return
}
task.runtime.Logger.Info("slave(%s) 'slaveof %s %d'", task.SlaveAddr(), task.MasterIP, task.MasterPort)

// waiting server change inner stats.
time.Sleep(time.Second * 2)
// slave 'confxx set disk-delete-count 50'
_, task.Err = task.SlaveCli.ConfigSet("disk-delete-count", "50")
if task.Err != nil {
Expand Down