This document describes how to back up databases automatically and manually.
TencentDB for MySQL High-Availability Edition supports auto backup and manual backup of databases.
TencentDB for MySQL High-Availability Edition supports two backup types:
- Physical backup, which is a full copy of physical data (supported for both auto backup and manual backup).
- Logical backup, which backs up SQL statements (only supported for manual backup).
- To restore a database from a physical backup, you need to use xbstream to decompress the package first. For more information, please see Restoring Database from Physical Backup.
- If the number of tables in a single instance exceeds one million, backup may fail, and database monitoring may be affected. Please control the number of tables in one single instance appropriately and make sure that it is below one million.
- As the data of tables created by the MEMORY storage engine is stored in the memory, physical backups cannot be created for such tables. To avoid data loss, it is recommended to replace them with InnoDB tables.
|Physical Backup Advantages
||Logical Backup Disadvantages
|High backup speed. Streaming backup and compression are supported. High success rate. Simple and efficient restoration. Faster backup-based coupling operations such as adding real-only and disaster recovery instances. 1/8 of average time needed for creating a logical backup. 10 times faster than logical backups during import.
||Long time needed to restore as it takes time to run SQL and build indexes. Low backup speed, especially when there are massive amounts of data. Possible increase in master-slave delay due to the pressure on instances during backup Possible loss of precision information of floating points. Potential backup failures due to wrong views and other problems. Slower backup-based coupling operations such as adding read-only and disaster recovery instances.
|MySQL v5.5, 5.6, and 5.7 (High-Availability Edition): Auto backup supports full physical backup. Manual backup supports full physical backup, full logical backup, and single-database/table logical backup. Both auto backup and manual backup can be compressed and downloaded. Auto backups cannot be manually deleted, but their retention periods can be set. Manual backups can be manually deleted in the console and will be retained until they are deleted.
||MySQL v5.5, 5.6, and 5.7 (High-Availability Edition): Log files occupy the instance's backup capacity. Log files can be downloaded but cannot be compressed. Retention periods can be set for log files.
- Starting from February 26, 2019, the auto backup feature of TencentDB for MySQL will only support physical backup (default type) and no longer provide logical backup. Existing automatic logical backups will be switched to physical backups automatically.
This will not affect your business access, but may have impact on your auto backup habit. If you need logical backups, you can use the manual backup method in the TencentDB for MySQL Console or call the relevant API to generate logical backups.
- Both logical and physical backup files will be compressed, so some files may be unusable after being downloaded. In that case, you can use the table backup feature in manual logical backup. For more information, please see manual backup.
- Instance backup files occupy backup capacity. Please develop a backup schedule and plan the backup capacity appropriately to avoid potential extra fees in the future.
- It is recommended to back up your database during off-hours.
- To avoid situations where the required backup files are deleted after the retention period lapses, please download them to the local file system in a timely manner.
- DDL operations are prohibited during the backup process so as to avoid backup failure due to table locking.
- Backup capacity in excess of the free tier will incur fees. For more information, please see Backup Capacity Billing Description.
Backing up MySQL Data Automatically
- Log in to the TencentDB for MySQL Console, click an instance name on the instance list page to enter the management page, and select Backup and Restore > Auto Backup Settings.
- Select backup parameters in the pop-up window as detailed below and click OK:
The rollback feature relies on the backup cycle and retention days of backup files. Reducing the frequency of auto backup and retention period will affect the rollback feature for instance data. Please configure backup appropriately based on your actual needs.
||To ensure data security, please back up your data at least twice a week. The default value is Monday to Sunday.
- The default backup initiation time is automatically assigned by the system.
- You can select a custom time range (preferably during off-peak hours). This is just the start time of the backup process and does not indicate the end time.
For example, if the time range is 02:00-06:00, the system will initiate a backup at a point in time during 02:00-06:00, which depends on the backend backup policy and backup system conditions.
|Data backup retention period
||Data backup files can be retained for 7 (default value) to 732 days.
|Log backup retention period
||Log backup files can be retained for 7 (default value) to 732 days. The number of days set for log backup retention must be smaller than that for data backup retention.
Backing up MySQL Data Manually
The manual backup feature allows you to initiate a backup task manually.
- Manual backup supports full physical backup, full logical backup, and single-database/table logical backup.
- You can delete manual backups in the backup list to release backup capacity.
- When the instance is performing daily auto backup, you cannot initiate a manual backup task.
- On the instance list page, click an instance name to enter the management page, and select Backup and Restore > Manual Backup.
- Select backup modes and objects in the pop-up window and click OK.
For single-database/table logical backup, select the database or table to be backed up in Select database & table in the left column and add the selected item to the right column. If you don't have a database, please create a database/table first.