diff --git a/dbm-services/redis/db-tools/dbmon/pkg/redisbinlogbackup/job.go b/dbm-services/redis/db-tools/dbmon/pkg/redisbinlogbackup/job.go index 568633b8dd..74f33fa55b 100644 --- a/dbm-services/redis/db-tools/dbmon/pkg/redisbinlogbackup/job.go +++ b/dbm-services/redis/db-tools/dbmon/pkg/redisbinlogbackup/job.go @@ -233,10 +233,13 @@ func (job *Job) CheckOldBinlogBackupStatus(port int) { // taskStatus==4,上传成功; // taskStatus<4,上传中; if taskStatus > 4 { - if row.Status != consts.BackupStatusToBakSystemFailed { // 失败状态不重复上报 + if row.Status != consts.BackupStatusToBakSystemFailed && + time.Now().Local().Sub(row.StartTime) > 1*time.Hour { + // 如果上传失败,且距离文件生成时间超过1小时,则上报 row.Status = consts.BackupStatusToBakSystemFailed - row.Message = fmt.Sprintf("上传失败,err:%s", statusMsg) + row.Message = fmt.Sprintf("上传失败,statusCode:%d,err:%s", taskStatus, statusMsg) row.BackupRecordReport(job.Reporter) + mylog.Logger.Error(fmt.Sprintf("%s %s", row.BackupFile, row.Message)) } } else if taskStatus < 4 { // 上传中,下次继续探测 diff --git a/dbm-services/redis/db-tools/dbmon/pkg/redisbinlogbackup/task.go b/dbm-services/redis/db-tools/dbmon/pkg/redisbinlogbackup/task.go index 1b95734632..6bd9e4d2f7 100644 --- a/dbm-services/redis/db-tools/dbmon/pkg/redisbinlogbackup/task.go +++ b/dbm-services/redis/db-tools/dbmon/pkg/redisbinlogbackup/task.go @@ -391,7 +391,7 @@ func (task *Task) mvBinlogToBackupDir() { filename := filepath.Base(task.BackupFile) var mvCmd string var targetName, targetFullPath string - if strings.Contains(filename, strconv.Itoa(task.ServerPort)) { + if strings.Contains(filename, "-"+strconv.Itoa(task.ServerPort)+"-") { // binlog-30012-0007515-20221110084710.log => binlog-1.1.1.1-30012-0007515-20221110084710.log targetName = strings.Replace(filename, "binlog-", "binlog-"+task.ServerIP+"-", -1) targetFullPath = filepath.Join(task.BackupDir, targetName) diff --git a/dbm-services/redis/db-tools/dbmon/pkg/redisfullbackup/backupjob.go b/dbm-services/redis/db-tools/dbmon/pkg/redisfullbackup/backupjob.go index c11da0ce5a..84ae5fd97a 100644 --- a/dbm-services/redis/db-tools/dbmon/pkg/redisfullbackup/backupjob.go +++ b/dbm-services/redis/db-tools/dbmon/pkg/redisfullbackup/backupjob.go @@ -231,10 +231,13 @@ func (job *Job) CheckOldFullbackupStatus(port int) { // taskStatus==4,上传成功; // taskStatus<4,上传中; if taskStatus > 4 { - if row.Status != consts.BackupStatusToBakSystemFailed { // 失败状态不重复上报 + if row.Status != consts.BackupStatusToBakSystemFailed && + time.Now().Local().Sub(row.StartTime) > 1*time.Hour { + // 如果上传失败,且距离文件生成时间超过1小时,则上报 row.Status = consts.BackupStatusToBakSystemFailed - row.Message = fmt.Sprintf("上传失败,err:%s", statusMsg) + row.Message = fmt.Sprintf("上传失败,statusCode:%d,err:%s", taskStatus, statusMsg) row.BackupRecordReport(job.Reporter) + mylog.Logger.Error(fmt.Sprintf("%s %s", row.BackupFile, row.Message)) } } else if taskStatus < 4 { // 上传中,下次继续探测