你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

快速入门:为 Azure Data Lake Storage 制定保管库备份策略

本快速入门介绍如何从 Azure 门户为 Azure Data Lake Storage 创建保管库备份策略。

先决条件

在为 Azure Data Lake Storage 创建保管库备份策略之前,请确保满足以下先决条件:

使用 Azure 门户为 Azure Data Lake Storage 配置保管库备份策略

备份策略定义备份 Azure Data Lake Storage 的计划和频率。 可以从备份保管库创建备份策略,也可以在备份配置期间立即创建备份策略。

若要从备份保管库为 Azure Data Lake Storage 配置存储于保管库中的备份策略,请执行以下步骤:

  1. Azure 门户中,转到 备份保管库>备份策略,然后选择“ + 添加”。

  2. 在“ 创建备份策略 ”窗格的“ 基本信息 ”选项卡上,提供 策略名称上的新策略的名称,然后选择 “数据源类型 ”作为 Azure Data Lake Storage

    屏幕截图显示了如何开始创建备份策略。

  3. 在“ 计划 + 保留 ”选项卡上的 “备份计划 ”部分下,将 备份频率 设置为 “每日 ”或“ 每周 ”,以及为备份创建恢复点的计划。

  4. “添加保留 期”部分下,编辑默认保留规则或添加新规则以指定恢复点的保留期。

  5. 选择“查看 + 创建”

  6. 评审成功后,选择“ 创建”。

本快速入门介绍如何使用 PowerShell 为 Azure Data Lake Storage 备份制定保管库备份策略。

先决条件

在为 Azure Data Lake Storage 制定保管库备份策略之前,请确保满足以下先决条件:

使用 PowerShell 为 Azure Data Lake Storage 配置保管库备份策略

若要为 Azure Data Lake Storage 配置保管库备份策略,请运行以下 cmdlet:

  1. 若要提取策略模板,请使用 Get-AzDataProtectionPolicyTemplate cmdlet。 此命令提取给定数据源类型的默认策略模板。 使用此策略模板创建新策略。

    $defaultPol = Get-AzDataProtectionPolicyTemplate -DatasourceType AzureDataLakeStorage
    
  2. 要创建保管备份策略,请定义备份的计划和保留期。 以下示例 cmdlet 创建一个备份策略,该策略每周在星期二和星期五上午 10 点进行备份,并保留备份三个月。

    $schDates = @(
    (
    (Get-Date -Year 2023 -Month 08 -Day 18 -Hour 10 -Minute 0 -Second 0)
    ),
    (
    (Get-Date -Year 2023 -Month 08 -Day 22 -Hour 10 -Minute 0 -Second 0)
    ))
    $trigger =  New-AzDataProtectionPolicyTriggerScheduleClientObject -ScheduleDays $schDates -IntervalType Weekly -IntervalCount 1
    Edit-AzDataProtectionPolicyTriggerClientObject -Schedule $trigger -Policy $defaultPol
    
    $lifeCycleVault = New-AzDataProtectionRetentionLifeCycleClientObject -SourceDataStore VaultStore -SourceRetentionDurationType Months -SourceRetentionDurationCount 3
    Edit-AzDataProtectionPolicyRetentionRuleClientObject -Policy $defaultPol -Name Default -LifeCycles $lifeCycleVault -IsDefault $true
    New-AzDataProtectionBackupPolicy -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -ResourceGroupName "resourceGroupName" -VaultName "vaultName" -Name "MyPolicy" -Policy $defaultPol
    
    

本快速入门介绍如何使用 Azure CLI 为 Azure Data Lake Storage 备份制定保管库备份策略。

先决条件

在为 Azure Data Lake Storage 创建保管库备份策略之前,请确保满足以下先决条件:

使用 Azure CLI 为 Azure Data Lake Storage 配置保管库备份策略

若要为 Azure Date Lake Storage 备份配置保管库备份策略,请运行以下命令:

重要

备份计划遵循 ISO 8601 持续时间格式。 但是,不支持重复间隔前缀 R ,因为备份配置为无限期运行。 指定的 R 的任何值都会被忽略。

  1. 若要了解 Azure Data Lake Storage 备份的备份策略组件,请使用 az dataprotection backup-policy get-default-policy-template 命令提取策略模板。 以下命令返回可用于创建新策略的给定数据源类型的默认策略模板。

    az dataprotection backup-policy get-default-policy-template --datasource-type AzureDataLakeStorage > policy.json
    
  2. 使用所有必需值保存策略 JSON 后,继续使用 az dataprotection backup-policy create 该命令从策略对象创建新策略。

    Az dataprotection backup-policy create -g adlsrg –vault-name TestBkpVault -n AdlsPolicy1  –policy policy.json
    

    以下示例 JSON 旨在配置 30 天默认保留策略,用于存储备份数据。 保管库备份计划于每天 7:30 UTC 进行。

    {
       "properties": {
          "policyRules": [
                {
                   "lifecycles": [
                      {
                            "deleteAfter": {
                               "objectType": "AbsoluteDeleteOption",
                               "duration": "P30D"
                            },
                            "targetDataStoreCopySettings": [],
                            "sourceDataStore": {
                               "dataStoreType": "VaultStore",
                               "objectType": "DataStoreInfoBase"
                            }
                      }
                   ],
                   "isDefault": true,
                   "name": "Default",
                   "objectType": "AzureRetentionRule"
                },
                {
                   "backupParameters": {
                      "backupType": "Discrete",
                      "objectType": "AzureBackupParams"
                   },
                   "trigger": {
                      "schedule": {
                            "repeatingTimeIntervals": [
                               "R/2025-10-13T07:00:00+00:00/P1D"
                            ],
                            "timeZone": "Coordinated Universal Time"
                      },
                      "taggingCriteria": [
                            {
                               "tagInfo": {
                                  "tagName": "Default",
                                  "id": "Default_"
                               },
                               "taggingPriority": 99,
                               "isDefault": true
                            }
                      ],
                      "objectType": "ScheduleBasedTriggerContext"
                   },
                   "dataStore": {
                      "dataStoreType": "VaultStore",
                      "objectType": "DataStoreInfoBase"
                   },
                   "name": "BackupDaily",
                   "objectType": "AzureBackupRule"
                }
          ],
          "datasourceTypes": [
                "Microsoft.Storage/storageAccounts/adlsBlobServices"
          ],
          "objectType": "BackupPolicy"
       },
       "id": "/subscriptions/ xxxxxxxx-xxxx-xxxx-xxxx /resourceGroups/ adlsrg/providers/Microsoft.DataProtection/backupVaults/ TestBkpVault/backupPolicies/AdlsPolicy1",
       "name": "AdlsPolicy1",
       "type": "Microsoft.DataProtection/backupVaults/backupPolicies"
    }
    

后续步骤