Backing up Database

Last updated: 2020-09-10 11:53:14

    This document describes how to automatically and manually back up databases.

    Backup Overview

    Backup modes

    TencentDB for MySQL High-Availability Edition and Finance Edition support automatic backup and manual backup of databases.

    Backup types

    TencentDB for MySQL High-Availability Edition and Finance Edition support two backup types:

    • Physical backup, which replicates full physical data (available for both automatic backup and manual backup).
    • Logical backup, which backs up SQL statements (only available for manual backup).

      Note:

      • To restore a database from a physical backup, xbstream is required to decompress backup files first. For more information, 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 make sure the number of tables in a single instance is no more than 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, we recommend that you convert them to InnoDB tables.
      • If there are a high number of tables in an instance with no primary key, backup may fail and instance high availability may be affected. Please create primary keys or secondary indexes for such 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.
  • Ten times faster than logical backups during import.
  • Long time needed to restore as it takes time to run SQL statements and build indexes.
  • Low backup speed, especially when there are massive amounts of data.
  • Possible increase in source-replica 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.
  • Backup objects

    Data Backup Log Backup
    TencentDB for MySQL High-Availability Edition and Finance Edition:
  • Automatic backup supports full physical backup.
  • Manual backup supports full physical backup, full logical backup, and single-database/table logical backup.
  • Both automatic backup and manual backup can be compressed and downloaded.
  • Automatic 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 High-Availability Edition and Finance Edition support binlog backup:
  • Log files occupy the instance's backup space.
  • Log files can be downloaded but cannot be compressed.
  • Retention periods can be set for log files.
  • Notes

    • 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 automatic backup habit. If you need logical backups, you can use the manual backup feature in the TencentDB for MySQL Console or call the CreateBackup 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, see Backing up MySQL Data Manually.
    • Instance backup files occupy backup space. We recommend that you develop a backup schedule and plan the usage of backup space appropriately to avoid incurring additional fees in the future.
    • We recommend that you back up your data during off-peak hours.
    • We recommend that you download the backup files locally before they are deleted after the retention period lapses.
    • Do not perform DDL operations during the backup process to avoid backup failure due to table locking.
    • Usage of backup space in excess of the free tier will incur fees. For more information, please see Backup Space Billing.

    Backing up MySQL Data Automatically

    1. Log in to the TencentDB for MySQL Console, click an instance name on the instance list page and enter the management page, and select Backup and Restore > Auto Backup Settings.
    2. Select backup parameters in the pop-up window (details are shown as below) and click OK:

      Note:

      The rollback feature relies on the backup cycle and retention days of backup files. Rollback will be affected if you reduce the automatic backup frequency and retention period. Please select the parameters as needed.

      Parameter Description
      Backup period To ensure data security, please back up your data at least twice a week. All seven days of the week will be selected by default.
      Backup start time
      • The default backup start time is automatically assigned by the system.
      • You can set a start time as needed. We recommend that you set it to off-peak hours. This is just the start time of the backup process and does not indicate the end time.
        For example, if the backup start time is set to 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 time Data backup files can be retained for 7 (default value) to 732 days.
      Log backup retention time 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.

    Note:

    • Manual backup supports full physical backup, full logical backup, and single-database/table logical backup.
    • You can delete manual backups from the backup list in the console to release backup space.
    • When the instance is performing daily automatic backup, no manual backup tasks can be initated.
    1. On the instance list page, click an instance name and enter the management page, and select Backup and Restore > Manual Backup.
    2. Select the backup mode and object in the pop-up window and click OK.

      Note:

      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 do not have a database, please create a database/table first.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help