The reliable backup feature helps prevent data loss. You can enable PolarDB for MySQL to automatic.ally create backups at specified intervals or manually create backups that take effect immediately. You can also retain backup data when you delete a PolarDB for MySQL cluster. This helps prevent data loss caused by user errors.

Backup types

Backup type Description
Level-1 backup (data backup)

Level-1 backups are created based on Redirect-on-Write (ROW) snapshots. These snapshots are stored in a cluster that supports distributed storage. The system does not replicate data when it saves a data block to a snapshot. When a data block is modified, the system saves one of the previous versions of the data block to a snapshot. At the same time, the system creates a new data block that is redirected by the original data block. Therefore, you can create backups within a few seconds regardless of the size of your database storage. Only a small amount of time is required to create and restore level-1 backups. However, level-1 backups take up large storage space.

PolarDB clusters are backed up and restored based on the multi-threading architecture. This improves the efficiency. It takes 40 minutes to restore or clone 1 TB of data based on backup sets (snapshots).

A backup can be retained for seven to 14 days.

By default, the level-1 backup feature is enabled to ensure data security.

The following figure shows the total size of level-1 backups (snapshots).

The total size of level-1 backups
Warning To disable the level-1 backup feature, submit a ticket to contact Customer Services.For more information, see Submit a ticket. However, after you disable this feature, you must bear the risks that may arise. For example, data loss may occur due to user errors.
Level-2 backup (data backup) Level-2 backups are level-1 backups that are compressed and then stored in on-premises storage media. Level-2 backups are slower to restore than level-1 backups. However, the costs incurred for level-2 backups are lower than that of level-1 backups.

Level-2 backups can be retained for 30 to 7,300 days. You can also enable the Retained Before Cluster Is Deleted feature.

By default, the level-2 backup feature is disabled.

If you enable this feature, expired level-1 backups are transferred to on-premises storage media and stored as level-2 backups. The level-1 backups are transferred to level-2 backups at a rate of approximately 150 MB/s.

Note If a level-1 backup expires before the previous level-1 backup is transferred to a level-2 backup, the level-1 backup is deleted and is not transferred to a level-2 backup. For example, the system creates level-1 backups at 01:00 every day for PolarDB clusters and retains the level-1 backups for 24 hours. The system creates Level-1 Backup A at 01:00 on January 1 and creates Level-1 Backup B at 01:00 on January 2. Level-1 Backup A expires at 01:00 on January 2 and starts to be transferred to a level-2 backup. However, Level-1 Backup A stores a large amount of data, and the transfer task is not complete by 01:00 on January 3. Therefore, after Level-1 Backup B expires at 01:00 on January 3, Level-1 Backup B is deleted and is not transferred to a level-2 backup.
Log backup

The log backup feature creates backups by uploading real-time redo logs to Object Storage Service (OSS) in parallel. Based on a full backup (snapshot) and the redo logs generated after the backup is created, you can perform point-in-time recovery (PITR) for a PolarDB cluster. Log backups can prevent data loss caused by user errors and ensure the security of data in the recent period.

Log backups can be retained for 7 to 7,300 days. You can also enable the Retained Before Cluster Is Deleted feature to store data permanently.

Note If you want to restore data to a specific time point, you must include the time required to replay the redo log files. It takes about 20 to 70 seconds to replay 1 GB of redo log data. The total restoration time is the sum of the time required to restore data based on backup sets (snapshots) and the time required to replay the redo log files.

Pricing

The backup and restoration features of PolarDB are free. Only storage fees are incurred. In PolarDB, the fees are calculated based on the storage space that is occupied by the backup files of data and logs and the retention periods of these backup files.

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
Hong Kong (China) and regions outside China USD 0.000650/GB/hour USD 0.0000455/GB/hour USD 0.0000455/GB/hour

Billing method

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

You can view the database storage usage of a cluster on the Overview page in the console.

Storage fee per hour = (Total size of level-1 backups - Free quota) × Unit price per hour
  • You can create level-1 backups for free if the total size of the level-1 backups does not exceed the free quota.
  • For more information about the unit price per hour, see Table 1.
  • You can view the total size of the level-1 backups in Total Physical Storage of Level-1 Backups, as shown in the following figure.Total Physical Storage of Level-1 Backups
    Note The total size of the level-1 backups in a PolarDB cluster is the sum of the dedicated physical storage space consumed by all level-1 backups, as shown in part ① in the preceding figure. This metric is not the sum of the logical data sizes of all level-1 backups, as shown in part ②. The data of the PolarDB cluster and multiple level-1 backups (snapshots) can be stored in the same physical data block that is calculated only once in the bill. For more information about backups, see FAQ about the backup feature.

For example, if the total size of level-1 backups (snapshots) is 700 GB and the database storage usage is 1,000 GB, the storage fee per hour is USD 0.0928.

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 = Total size of level-2 backups × Unit price per hour

For example, if the total size of level-2 backups is 1,000 GB, the storage fee per hour is USD 0.0325.

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 = (Total size of log backups - 100 GB) × Unit price per hour

For example, if the total size of log backups is 1,000 GB, the storage fee per hour is USD 0.02925.

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

Backup methods

Backup methods Description
Automatic system backup
  • By default, automatic backup is performed once a day. You can configure the start time and the backup cycle for the automatic backup. For more information, see Configure automatic backup.
  • Automatically created backup files cannot be deleted.
Note To prevent data loss, automatic backup must be performed at least twice a week.
Manual backup
  • You can manually back up data at any time. You can manually 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. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then 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 panel that appears, configure the following parameters.
    Backup settings-1
    Parameter Description
    Backup Method The default value Snapshot Backup is used.
    Backup Cycle The backup cycle.
    Note To prevent data loss, automatic backup must be performed at least twice a week.
    Start Time The start time for automatic backup.
    Level-1 Backups Retained For The retention period for level-1 backups.
    Note Level-1 backups can be retained for 7 to 14 days.
    Level-2 Backup Specifies whether to enable the level-2 backup feature.
    Note By default, level-2 backup is disabled.
    Level-2 Backups Retained For The retention period for level-2 backups.
    Note
    • Level-2 backups can be retained for 30 to 7,300 days.
    • To retain level-2 backups permanently, select Retained Before Cluster Is Deleted. The retention period parameter becomes unavailable after you select this option.
    Log Backups Retained For The retention period for log backups.
    Note
    • Log backup files can be retained for 7 to 7,300 days.
    • To retain log backups permanently, select Retained Before Cluster Is Deleted. The retention period parameter becomes unavailable after you select this option.
    When Cluster Is Deleted The backup retention policy that applies when you delete a cluster.
    • Retain All Backups Permanently: retains all backups after you delete a cluster.
    • Retain Last Automatic Backup Permanently: retains the latest backup after you delete a cluster.
    • Delete All Backups Immediately: does not retain backups after you delete a cluster.
    Note
    • If you select the Retain All Backups Permanently or Retain Last Automatic Backup Permanently policy, the system runs an automatic backup task to store all data when you delete a cluster.
    • After you delete a cluster, level-1 backups are automatically transferred to level-2 backups. You can go to the Cluster Recycle page to view stored backups. For more information, see Cluster recycle bin.
  7. After you configure backup settings, click OK.

Manually create a backup

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then 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, click OK.
    Note You can manually create up to three backups for a cluster.

Restore data

For more information, see Restore data.

FAQ

  • Is the total size of level-1 backups (snapshots) equal to the sum of the sizes of all the level-1 backups (snapshots)?
    No, the total size of level-1 backups (snapshots) is not equal to the sum of the sizes of all the backups (snapshots). The total size of level-1 backups (snapshots) is displayed in the ① section, as shown in the following figure.The total size of level-1 backups (snapshots)
  • Why is the total size of level-1 backups smaller than the sum of the sizes of all the backups?

    The size of level-1 backups in PolarDB is measured in two forms: the logical size of each backup and the total physical size of all the backups. PolarDB uses snapshot chains to store level-1 backups. Only one record is generated for the same data blocks. Therefore, the total physical size of all the level-1 backups is smaller than the total logical size of all the level-1 backups. In some cases, the total physical size of all the level-1 backups is smaller than the logical size of a single backup.

  • How am I billed for backups in PolarDB?

    You are billed for the storage space of level-1 backups, level-2 backups, and log backups. By default, the level-1 backup and log backup features are enabled and you can use some storage space for free. By default, the level-2 backup feature is disabled.

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

    The fee is calculated based on the following formula: Storage fee per hour = (Total size of level-1 backups - Used database storage space × 50%) × Price per hour. For example, assume that the total size of level-1 backups of a PolarDB database is 700 GB and the used database storage space is 1,000 GB. Then, the storage fee per hour is calculated based on the following formula:[700 GB - 500 GB] × USD 0.000464/GB = USD 0.0928.

  • Can I use a storage plan to offset the storage fees of backups?

    No, you cannot use a storage plan to offset the storage fees of backups. A storage plan can be used to offset only the storage fees of business data.

  • Is level-1 backup the only backup type that can be manually created?

    Yes, only level-1 backups can be manually created.

  • How long is a manually created backup retained?

    A manually created backup is retained until it is manually deleted or the cluster is released. If you set the backup policy to Retain All Backups Permanently, the backup is retained after you delete the cluster.

  • How do I view the size of a level-2 backup?

    You can view the size of a level-2 backup on the Backups tab in the console.

    1

Related API operations

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