This topic describes how to enable PolarDB-P to automatically create backups at specified intervals or manually create backups to prevent data loss. PolarDB-P also allows you to retain backups of a cluster when you delete the cluster.

Features

PolarDB allows you to retain backups for long-term use. You can set the backup feature to automatically retain backups of a cluster when you delete the cluster. This can avoid data loss caused by user errors.

Level-1 backups are created by saving Redirect-on-Write (ROW) snapshots. The system does not replicate a data block when it saves the data block to a snapshot. When a data block is modified, the system saves one of the former versions of the data block to a snapshot, and creates a new data block that is redirected by the original data block. Therefore, you can disregard the size of your database storage and create backups within a few seconds.

The log backup feature creates backups by updating Redo logs to Object Storage Service (OSS) in parallel. Based on a full data backup (snapshot) and Redo logs, you can restore an Apsara PolarDB cluster to a time point. This is known as Point-In-Time Recovery (PITR).

The backup and restoration features of Apsara PolarDB clusters both support multi-threaded parallel processing to improve efficiency. A level-1 backup (snapshot) can be restored or cloned at a rate of 1 TB every 40 minutes. If you perform a PITR, you must first consider the amount of time that is required to query Redo logs. Redo logs are queried at a rate of 1 GB every 20 seconds to 1 GB every 70 seconds. The total restoration duration is the sum of the snapshot restoration time and the Redo logs query time.

Pricing

The backup and restore features of Apsara PolarBD are free of charge. Only storage fees are charged. Fees are calculated based on the storage consumed by backups (cluster and log data) and the amount of time that the backups have been retained.

Note

Starting at 10:00 am on June 10, 2020 (Beijing Time), Alibaba Cloud begins charging for the backup feature of Apsara PolarBD.For more information, see [Notice] Alibaba Cloud begins charging for backups.

Table 1. Pricing
Region Level-1 backup Level-2 backup Log backup
Mainland China USD 0.000464/GB/hour USD 0.0000325/GB/hour USD 0.0000325/GB/hour
China (Hong Kong) and regions outside China USD 0.000650/GB/hour USD 0.0000455/GB/hour USD 0.0000455/GB/hour

Billing methods

Backup type Free quota Billing method
Level-1 backup Database storage usage × 50%

To check the database storage usage, log on to the Apsara for PolarDB console, and click the cluster name to navigate to the Overview page.

Storage fee per hour = (The total physical storage of level-1 backups - Free quota) × Unit price per hour
  • You can use level-1 backups for free if the physical storage of the level-1 backups is less than 50% of database storage usage.
  • For more information about the unit price per hour, see Table 1.
  • Section 1 in the following figure displays the total physical storage of the level-1 backups. Section 2 displays the total logical storage of the level-1 backups.Total physical storage of level-1 backups

For example, if the total physical storage of the level-1 backups is 700 GB and database storage usage is 1,000 GB, the storage fee per hour is USD 0.6.

The fee is calculated based on the following formula: [700 GB - (1,000 GB × 50%)] × USD 0.000464 = USD 0.0928

Level-2 backup None Storage fee per hour = The total physical storage of level-2 backups × Unit price per hour

For example: The total physical storage of level-2 backups is 1,000 GB. The storage fee per hour is USD 0.21.

The fee is calculated based on the following formula: 1,000 GB × USD 0.0000325 = USD 0.0325

Log backup 100 GB Storage fee per hour = (The total physical storage of log backups - 100 GB) × Unit price per hour

For example: The total physical storage of log backups is 1,000 GB. The storage fee per hour is USD 0.189.

The fee is calculated based on the following formula: (1,000 GB - 100 GB) × USD 0.0000325 = USD 0.02925

Backup types

Backup type Description
Level-1 backup (data backup) Level-1 backups are stored on a distributed storage cluster. Level-1 backups are fast to create and restore. However, the costs are high.

Apsara PolarDB periodically backs up your data by creating Redirect-on-Write (ROW) snapshots. The system does not replicate a data block when it saves the data block to a snapshot. When a data block is modified, the system saves one of the former versions of the data block to a snapshot, and creates a new data block that is redirected by the original data block. Therefore, you can disregard the size of your database storage and create backups within 30 seconds.

The retention period for level-1 backups is from 7 to 14 days.

To check the total physical storage of level-1 backups, follow the steps shown in the following figure.

The total physical storage of level-1 backups
Level-2 backup (data backup) Level-2 backups refer to level-1 backups that are compressed and then stored in local storage media. Level-2 backups are slower to restore compared with level-1 backups but the costs are lower.

The retention period for level-2 backups is from 30 to 7,300 days. You can enable the Retained Before Cluster Is Deleted feature.

Note
  • By default, the level-2 backup feature is disabled.
  • If you enable this feature, expired level-1 backups will be transferred to a local storage medium and stored as level-2 backups. The backups are transferred at a rate of approximately 150 MB/s.
  • If the current backup transfer task is not finished at the specified time, the system continues the ongoing backup transfer and skips other transfer tasks. For example, you can allow the system to create level-2 backups at 01:00 (UTC+8). Level-1 Backup A is expired at 01:00 (UTC+8), and transferred to a local storage medium as a level-2 backup. Level-1 Backup A stores a large amount of data. As a result, the system continues the transfer that is not finished at 01:00 (UTC+8) the next day. Level-1 Backup B scheduled for transfer is expired and then deleted.
Log backup A log backup stores the Redo log of a database for point-in-time recovery (PITR). Using log backups can avoid data loss caused by user errors.

The retention period for log backups is from 7 to 7,300 days. You can also enable the Retained Before Cluster Is Deleted feature to store data permanently.

Backup methods

Backup method Description
System backup (Auto)
  • By default, automatic backup is performed once a day. You can configure the start time and backup cycle for automatic backup. For more information, see Configure automatic backup.
  • Automatically created backup files cannot be deleted.
Note To ensure data security, automatic backup must be performed at least twice a week.
Manual backup
  • You can manually back up data at any time. You can create up to three backups for a cluster. For more information, see Manually create a backup.
  • Manually created backup files can be deleted.

Configure automatic backup

  1. Login ApsaraDB for PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is located.
  3. Find the target cluster and click the cluster ID.
  4. In the left-side navigation pane, choose Settings and Management > Backup and Restore.
  5. Click Backup Settings.
    Backup settings
  6. In the dialog box that appears, configure parameters as follows.
    Backup settings-1
    Parameter Description
    Backup Method The default value Snapshot Backup is used and cannot be changed.
    Backup Cycle Set the backup cycle.
    Note To ensure data security, automatic backup must be performed at least twice a week.
    Start Time Set the start time for automatic backup.
    Level-1 Backups Retained For Set the retention period for level-1 backups.
    Note The retention period for level-1 backups is from 7 to 14 days.
    Level-2 Backup Enable or disable level-2 backup.
    Note By default, level-2 backup is disabled.
    Level-2 Backups Retained For Set the retention period for level-2 backups.
    Note
    • The retention period for level-2 backups is from 30 to 7,300 days.
    • To store level-2 backups permanently, you can select Retained Before Cluster Is Deleted. Then, you cannot set the retention period.
    Log Backups Retained For Set the retention period for log backups.
    Note
    • The retention period for log backups is from 7 to 7,300 days.
    • To save log backups permanently, you can select Retained Before Cluster Is Deleted. Then, you cannot set the retention period.
    When Cluster Is Deleted Set the backup retention policy that applies when you delete a cluster.
    • Retain All Backups Permanently: saves all backups when you delete a cluster.
    • Retain Last Automatic Backup Permanently: saves the latest backup when you delete a cluster.
    • Delete All Backups Immediately: does not save any backup when you delete a cluster.
    Note
    • If you choose the Retain All Backups PermanentlyorRetain Last Automatic Backup Permanently policy, the system will run an automatic backup task to save all data when you delete a cluster.
    • After you delete a cluster, level-1 backups will be automatically archived to level-2 backups. You can go to the Cluster Recycle page to view stored backups. For more information, see Cluster recycle bin.
  7. Click OK.

Manually create a backup

  1. Login ApsaraDB for PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is located.
  3. Find the target cluster and click the cluster ID.
  4. In the left-side navigation pane, choose Settings and Management > Backup and Restore.
  5. On the Backups tab, click Create Backup.
    Create backup
  6. In the Create Backup message that appears, click OK.
    Note You can create up to three backups for a cluster.

Restore data

For more information, see Restore data.

FAQ

  • Does the total physical storage of level-1 backups equal the sum of all backups?
    The total physical storage of level-1 backups does not equal the sum of all backups. The total physical storage of level-1 backups is displayed in the ① section, as shown in the following figure.The total physical storage of level-1 backups
  • Why is the total physical storage of level-1 backups smaller than the size of a single backup?

    Level-1 backups in Apsara PolarDB are measured by using two methods: the physical storage of all backups and the logical storage of each backup. Apsara PolarDB uses snapshot chains to store level-1 backups. Each data block is replicated only once. Therefore, the physical storage of all level-1 backups is smaller than the total logical storage of all level-1 backups, or sometimes even smaller than the logical storage of a single backup.

  • How are backups in Apsara PolarDB backup billed?

    Storage fees are charged for level-1 backups, level-2 backups, and log backups. By default, level-1 backup and log backup are enabled, but level-2 backup is disabled. Alibaba Cloud also offers free storage for level-1 backups and log backups.

  • What is the billing method of level-1 backups?

    Storage fee per hour = (Total physical storage of level-1 backups - Database storage usage x 50%) x Unit price per hour. For example, the total physical storage of level-1 backups of an Apsara PolarDB cluster is 700 GB and the database storage usage is 1,000 GB. Then, the storage fee per hour is calculated as (700 GB - 500 GB) × USD 0.000464/GB = USD 0.0928.

  • Can I use a storage plan to deduct the storage fee?

    No, a storage plan can only be used to deduct storage fees incurred by the stored data. It is not applicable to backups.

Related operations

API Description
CreateBackup Creates a full snapshot for a specified Apsara PolarDB cluster.
DescribeBackups Queries the backup information of a specified Apsara PolarDB cluster.
DeleteBackup Deletes the backups of an Apsara PolarDB cluster.
DescribeBackupPolicy Queries the automatic backup policy of a specified Apsara PolarDB cluster.
ModifyBackupPolicy Modifies the automatic backup policy of a specified Apsara PolarDB cluster.