Data is a core asset for enterprises. As an enterprise grows its business, its data increases exponentially. This requires business applications to be able to process data online and in real time. It becomes more challenging for database O&M personnel to protect the core data of their enterprises, because various factors, such as accidental data deletion, system vulnerabilities, ransomware, hardware failures, and natural disasters, may cause data losses. Therefore, data backup and restoration are important features of databases.
PolarDB supports data backup and redo log backup. Backing up data is a process of creating a backup set (snapshot) of all data on a cluster at a certain point in time. Backing up redo logs is a process of recording the new data after a backup set is created. You can restore your PolarDB cluster or a specific instance or table in your cluster to any point in time by using a full data backup set and the redo logs generated after the backup set is created.
Data backups are divided into level-1 backups and level-2 backups by storage location.
|The location where backup sets are stored||Enabled by default?||Retention period||Characteristics||How to view the size of a backup set|
|Level-1 backups||Yes||3–14 days||
Warning By default, the level-1 backup feature is enabled. To disable the feature, you need to submit a ticket. We recommend that you keep the level-1 backup feature enabled if possible to reduce the risk of data loss. If the feature is disabled, data loss may occur, for example, due to user errors.
|The following figure shows the total physical storage of level-1 backups.
Note The total size of level-1 backups of a PolarDB cluster is the sum of the dedicated physical storage occupied by all level-1 backups, as shown in part ①. It 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 billed only once. For more information, see FAQ about the backup feature.
Note If a level-1 backup expires before the previous one is transferred to a level-2 backup, the level-1 backup is deleted and is not transferred to a level-2 backup. For example, a PolarDB cluster creates level-1 backups at 01:00 every day and retains the backups for 24 hours. If the PolarDB cluster 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 completed by 01:00 on January 3. In this case, Level-1 Backup B is deleted after it expires at 01:00 on January 3 and is not transferred to a level-2 backup.
|The following figure shows the total size of level-2 backups. The total size of level-2 backups is the sum of the data sizes of all level-2 backups.|
Redo log backups
The log backup feature allows you to create backups by uploading real-time redo logs to Object Storage Service (OSS) in parallel. The feature is enabled by default, and log backups are retained for 3 to 7,300 days. You can save the backups permanently by enabling the Retained Before Cluster Is Deleted feature.
Log backup enables consistent backup at any point in time.Note Based on a full backup set (snapshot) and the redo logs generated after the backup set is created, you can perform a 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 that is generated within a period of time. If you perform a PITR, you must 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 70 seconds. The total restoration duration is the sum of the time required to restore backup sets and the time required to query redo logs.
- How to view the size of a backup set
As shown in the following figure, the total size of log backups is the sum of the size of each log backup file.