ALIYUN::HBR::DbPlan类型用于创建备份计划。

语法

{
  "Type": "ALIYUN::HBR::DbPlan",
  "Properties": {
    "Options": String,
    "InstanceUuid": String,
    "SourceType": String,
    "VaultId": String,
    "Source": Map,
    "ContinuousPlan": String,
    "IncPlan": String,
    "MaxRetrySeconds": Integer,
    "HostUuid": String,
    "CumulativePlan": String,
    "FullPlan": String,
    "LogPlan": String,
    "MaxRateLimit": Integer,
    "DbPlanName": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
Options String 备份选项。 取值为JSON格式的字符串,且不同数据源类型(SourceType)对应的取值不同。
  • 当数据源类型为ORACLE时,取值示例:{"channels":4,"compression":"lzop","offline_backup":false,"archivelog_reserve_hours":24,"custom_commands":""}
    • channels:表示并发的数量。
    • archivelog_reserve_hours:表示备份作业完成后,删除存档日志的时间。
    • 其他参数应使用默认值。
    说明 关于备份Oracle的更多信息,请参见备份Oracle
  • 当数据源类型为MYSQL时,取值示例:{"channels":4,"compression":"lzop","del_binlog":false},

    其中,del_binlog表示备份完成后是否删除binlog,仅对日志备份或实时备份生效。

    说明 关于备份MYSQL的更多信息,请参见备份MYSQL
  • 当数据源类型为MSSQL时,取值示例:{\"channels\":4,\"verify\":false,\"compression\":\"lzop\",\"backup_new_databases\":false}.
    说明 关于备份MSSQL的更多信息,请参见备份SQL Server
InstanceUuid String 数据库实例UUID。
SourceType String 数据源类型。 取值:
  • MYSQL
  • ORACLE
  • MSSQL
VaultId String 仓库ID。
Source Map 将要备份的数据库实例。 更多信息,请参见Source语法Source属性
ContinuousPlan String 连续日志备份计划。 取值:{"type": "continuous"}
IncPlan String 增量备份计划。

仅适用于MYSQL和ORACLE类型的数据源。

取值为JSON格式的字符串,具体示例如下:
  • 按日周期备份时:{"type": "daily", "start": "00:00:00", "interval": 3},
  • 按星期周期备份时:{"type":"weekly","start": "03:00:00","days": [1,2,3,4,5],"interval": 1}
说明
  • day表示具体某一天,取值范围是0~6,其中0表示星期天。
  • interval表示间隔,取值范围是1~52。
MaxRetrySeconds Integer 断线重连时间。 备份时,断开数据库后重新连接的时间间隔。默认为600秒。
HostUuid String 客户端主机UUID。
CumulativePlan String 累计增量备份计划。

仅适用于MSSQL类型的数据源。

取值为JSON格式的字符串,具体示例如下:
  • 按日周期备份时:{"type": "daily", "start": "00:00:00", "interval": 3},
  • 按星期周期备份时:{"type":"weekly","start": "03:00:00","days": [1,2,3,4,5],"interval": 1}
说明
  • day表示具体某一天,取值范围是0~6,其中0表示星期天。
  • interval表示间隔,取值范围是1~52。
FullPlan String 完全备份计划。 取值为JSON格式的字符串,具体示例如下:
  • 按日周期备份时:{"type": "daily", "start": "00:00:00", "interval": 3},
  • 按星期周期备份时:{"type":"weekly","start": "03:00:00","days": [1,2,3,4,5],"interval": 1}
说明
  • day表示具体某一天,取值范围是0~6,其中0表示星期天。
  • interval表示间隔,取值范围是1~52。
LogPlan String 日志备份计划。 取值为JSON格式的字符串,具体示例如下:
  • 按日周期备份时:{"type": "daily", "start": "00:00:00", "interval": 3},
  • 按星期周期备份时:{"type":"weekly","start": "03:00:00","days": [1,2,3,4,5],"interval": 1}
说明
  • day表示具体某一天,取值范围是0~6,其中0表示星期天。
  • interval表示间隔,取值范围是1~52。
MaxRateLimit Integer 速度限制。 默认为0,表示不限速。
DbPlanName String 备份计划的名称。

Source语法

"Source": {
  "Entries": List
}

Source属性

属性名称 类型 必须 允许更新 描述 约束
Entries List 备份源。 取值:
  • 当数据源类型为ORACLE时:["oracle://${instanceName}", "oracle://${instanceName}/archivelog"]

    其中${instanceName}为Oracle数据库实例的名称,可从dbAgent(ORACLE)资源获取。

  • 当数据源类型为MYSQL时:["mysql://${instanceName}"]

    其中${instanceName}为MYSQL数据库实例的名称,可从dbAgent(MySQL)资源获取。

  • 当数据源类型为MSSQL时:["mssql://${instanceName}/${databse1}", "mssql://${instanceName}/${databse2}"]

    其中,${database}可以从dbAgent资源(MSSQL)获取。

返回值

Fn::GetAtt

  • Options:JSON格式的备份选项。
  • InstanceUuid:数据库实例ID
  • CumulativeUuid:增量计划ID。
  • SourceType:数据库类型。
  • PlanId:计划ID。
  • LogUuid:日志ID。
  • VaultId:仓库ID。
  • IncUuid:增量备份计划ID。
  • ContinuousPlan:连续日志备份计划。
  • IncPlan:增量备份计划。
  • MaxRetrySeconds:断线重连时间。
  • Target:要备份的目标。
  • HostUuid:客户端主机UUID。
  • ContinuousUuid:连续日志备份UUID。
  • CumulativePlan:累计增量备份计划。
  • FullPlan:完全备份计划。
  • LogPlan:日志备份计划。
  • MaxRateLimit:速度限制。
  • FullUuid:完全备份计划UUID。
  • DbPlanName:备份计划的名称。

示例

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "Options": {
      "Type": "String",
      "Description": "Backup options in json format, different for each type of database. For Oracle, use {\"channels\":4,\"compression\":\"lzop\",\"offline_backup\":false,\"archivelog_reserve_hours\":24,\"custom_commands\":\"\"}, \"channels\" means numbers of concurrent theads, \"archivelog_reserve_hours\" means how long before the archive log will be deleted after backup job completed, other paramters should use the default value. For Mysql, use {\"channels\":4,\"compression\":\"lzop\",\"del_binlog\":false}, \"del_binlog\" means whether the binlog will be deleted after backup completed, only take effect for log or continuous backup. For SQL Server, use {\\\"channels\\\":4,\\\"verify\\\":false,\\\"compression\\\":\\\"lzop\\\",\\\"backup_new_databases\\\":false}.",
      "Default": "{\"channels\":4,\"compression\":\"lzop\",\"del_binlog\":false}"
    },
    "InstanceUuid": {
      "Type": "String",
      "Description": "Uuid of database instance.",
      "Default": "d12729b82116154****"
    },
    "SourceType": {
      "Type": "String",
      "Description": "Database type, allowed value: MYSQL, ORACLE, MSSQL",
      "Default": "MYSQL"
    },
    "VaultId": {
      "Type": "String",
      "Description": "Vault ID to create backup plan, the backup data will be stored to the vault.",
      "Default": "v-df****"
    },
    "Source": {
      "Type": "Json",
      "Description": "Which database instance or database will be backup.",
      "Default": "{\n  \"Entries\": [\n    \"mysql://MYSQL-3306\"\n  ]\n}"
    },
    "ContinuousPlan": {
      "Type": "String",
      "Description": "Continuous backup plan schedule. Use {   \"type\": \"continuous\" }.",
      "Default": "continuous"
    },
    "IncPlan": {
      "Type": "String",
      "Description": "Incremental backup plan schedule. Only for mysql and oracle. More details see FullPlan.",
      "Default": "{\n    \"interval\": 1,\n    \"start\": \"00:00:00\",\n    \"type\": \"daily\"\n  }"
    },
    "MaxRetrySeconds": {
      "Type": "Number",
      "Description": "Max retry seconds on network failure.",
      "Default": "600"
    },
    "HostUuid": {
      "Type": "String",
      "Description": "Uuid of the host of the database instance.",
      "Default": "701781640b3afc****"
    },
    "FullPlan": {
      "Type": "String",
      "Description": "Full backup plan schedule. daily: {\"type\": \"daily\", \"start\": \"00:00:00\", \"interval\": 3}, weekly {\"type\":\"weekly\",\"start\": \"03:00:00\",\"days\": [1,2,3,4,5],\"interval\": 1}, days can be 0 - 6, 0 means Sunday, and interval can be 1 - 52.",
      "Default": "{\n    \"days\": [\n      6\n    ],\n    \"interval\": 1,\n    \"start\": \"18:00:00\",\n    \"type\": \"weekly\"\n  }"
    },
    "DbPlanName": {
      "Type": "String",
      "Description": "Display name of the backup plan.",
      "Default": "test"
    }
  },
  "Resources": {
    "HBRDbPlan": {
      "Type": "ALIYUN::HBR::DbPlan",
      "Properties": {
        "Options": {
          "Ref": "Options"
        },
        "InstanceUuid": {
          "Ref": "InstanceUuid"
        },
        "SourceType": {
          "Ref": "SourceType"
        },
        "VaultId": {
          "Ref": "VaultId"
        },
        "Source": {
          "Ref": "Source"
        },
        "ContinuousPlan": {
          "Ref": "ContinuousPlan"
        },
        "IncPlan": {
          "Ref": "IncPlan"
        },
        "MaxRetrySeconds": {
          "Ref": "MaxRetrySeconds"
        },
        "HostUuid": {
          "Ref": "HostUuid"
        },
        "FullPlan": {
          "Ref": "FullPlan"
        },
        "DbPlanName": {
          "Ref": "DbPlanName"
        }
      }
    }
  },
  "Outputs": {
    "Options": {
      "Description": "Backup options in json format, different for each type of database. For Oracle, use {\"channels\":4,\"compression\":\"lzop\",\"offline_backup\":false,\"archivelog_reserve_hours\":24,\"custom_commands\":\"\"}, \"channels\" means numbers of concurrent theads, \"archivelog_reserve_hours\" means how long before the archive log will be deleted after backup job completed, other paramters should use the default value. For Mysql, use {\"channels\":4,\"compression\":\"lzop\",\"del_binlog\":false}, \"del_binlog\" means whether the binlog will be deleted after backup completed, only take effect for log or continuous backup. For SQL Server, use {\\\"channels\\\":4,\\\"verify\\\":false,\\\"compression\\\":\\\"lzop\\\",\\\"backup_new_databases\\\":false}.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "Options"
        ]
      }
    },
    "InstanceUuid": {
      "Description": "Uuid of database instance.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "InstanceUuid"
        ]
      }
    },
    "CumulativeUuid": {
      "Description": "Uuid of cumulative plan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "CumulativeUuid"
        ]
      }
    },
    "SourceType": {
      "Description": "Database type, allowed value: MYSQL, ORACLE, MSSQL",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "SourceType"
        ]
      }
    },
    "PlanId": {
      "Description": "Id of the backup plan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "PlanId"
        ]
      }
    },
    "LogUuid": {
      "Description": "Uuid of the log backup plan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "LogUuid"
        ]
      }
    },
    "VaultId": {
      "Description": "Vault ID to create backup plan, the backup data will be stored to the vault.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "VaultId"
        ]
      }
    },
    "IncUuid": {
      "Description": "Uuid of the incremental bakcup plan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "IncUuid"
        ]
      }
    },
    "ContinuousPlan": {
      "Description": "Continuous backup plan schedule. Use {   \"type\": \"continuous\" }.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "ContinuousPlan"
        ]
      }
    },
    "IncPlan": {
      "Description": "Incremental backup plan schedule. Only for mysql and oracle. More details see FullPlan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "IncPlan"
        ]
      }
    },
    "MaxRetrySeconds": {
      "Description": "Max retry seconds on network failure.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "MaxRetrySeconds"
        ]
      }
    },
    "Target": {
      "Description": "Target vault to backup.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "Target"
        ]
      }
    },
    "HostUuid": {
      "Description": "Uuid of the host of the database instance.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "HostUuid"
        ]
      }
    },
    "ContinuousUuid": {
      "Description": "Uuid of continuous backup plan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "ContinuousUuid"
        ]
      }
    },
    "CumulativePlan": {
      "Description": "Cumulative plan schedule, only for mssql. More details see FullPlan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "CumulativePlan"
        ]
      }
    },
    "FullPlan": {
      "Description": "Full backup plan schedule. daily: {\"type\": \"daily\", \"start\": \"00:00:00\", \"interval\": 3}, weekly {\"type\":\"weekly\",\"start\": \"03:00:00\",\"days\": [1,2,3,4,5],\"interval\": 1}, days can be 0 - 6, 0 means Sunday, and interval can be 1 - 52.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "FullPlan"
        ]
      }
    },
    "LogPlan": {
      "Description": "Log backup plan schedule.More details see FullPlan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "LogPlan"
        ]
      }
    },
    "MaxRateLimit": {
      "Description": "Max rate limit for backup job,",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "MaxRateLimit"
        ]
      }
    },
    "FullUuid": {
      "Description": "Uuid of full backup plan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "FullUuid"
        ]
      }
    },
    "DbPlanName": {
      "Description": "Display name of the backup plan.",
      "Value": {
        "Fn::GetAtt": [
          "HBRDbPlan",
          "DbPlanName"
        ]
      }
    }
  }
}