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): 单实例下架,不会上传备份系统 #8829 #8832

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 @@ -181,9 +181,12 @@ func (job *RedisBackup) Run() (err error) {
// 如果是永久备份,那么需要检查上传结果情况
// 结束时间依赖上传时间最长的那个,所以没必要去并发探测
if job.params.BackupType == consts.ForeverBackupType {
job.runtime.Logger.Info(fmt.Sprintf("backup type is[%s], check upload status, task ids [%+v]",
job.runtime.Logger.Info(fmt.Sprintf("backup type is[%s], check upload status, task ids %+v",
job.params.BackupType, bakTaskIDs))
for _, taskId := range bakTaskIDs {
if strings.TrimSpace(taskId) == "" {
continue
}
// 半个小时还没上传成功则认为失败了
for i := 0; i < 60; i++ {
// taskStatus>4,上传失败;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,9 @@ def redis_ins_shutdown_flow(self):
acts_list = []
for ins_info in all_ins_info["ins_info_list"]:
act_kwargs.exec_ip = ins_info["master_ip"]
act_kwargs.cluster["bk_biz_id"] = str(self.data["bk_biz_id"])
act_kwargs.cluster["backup_host"] = ins_info["master_ip"]
act_kwargs.cluster["backup_instances"] = [ins_info["port"]]
act_kwargs.cluster["ssd_log_count"] = {}
act_kwargs.cluster["immute_domain"] = ins_info["domain_name"]
act_kwargs.cluster["domain_name"] = ins_info["domain_name"]

act_kwargs.get_redis_payload_func = RedisActPayload.redis_cluster_backup_4_scene.__name__
act_kwargs.get_redis_payload_func = RedisActPayload.redis_cluster_backup_payload.__name__
acts_list.append(
{
"act_name": _("redis备份: {}").format(ins_info["domain_name"]),
Expand Down
8 changes: 6 additions & 2 deletions dbm-ui/backend/flow/utils/redis/redis_act_playload.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,11 @@ def redis_cluster_backup_payload(self, **kwargs) -> dict:
redis集群备份
"""
ip = kwargs["ip"]
cluster = Cluster.objects.get(immute_domain=self.cluster["domain_name"])
if "params" in kwargs and "domain_name" in kwargs["params"]:
domain_name = kwargs["params"]["domain_name"]
else:
domain_name = self.cluster["domain_name"]
cluster = Cluster.objects.get(immute_domain=domain_name)
return {
"db_type": DBActuatorTypeEnum.Redis.value,
"action": DBActuatorTypeEnum.Redis.value + "_" + RedisActuatorActionEnum.Backup.value,
Expand All @@ -939,7 +943,7 @@ def redis_cluster_backup_payload(self, **kwargs) -> dict:
"ip": ip,
"ports": self.cluster[ip],
"backup_type": self.cluster["backup_type"],
"domain": self.cluster["domain_name"],
"domain": domain_name,
"without_to_backup_sys": not BACKUP_SYS_STATUS,
"backup_client_storage_type": "", # 留空,使用系统默认
},
Expand Down