Database Backup supports the backup of MySQL databases based on binary logs in addition to full backup and incremental backup. You can perform full backup, incremental backup, and log backup to restore a database to a point in time and achieve second-level recovery point objective (RPO).

Billing

Log backup is free of charge. Fees are incurred for the backup of binary logs and the storage of the backup data. The billable items are the same as those of MySQL database backup. For more information, see Billing overview.

Preparations

  1. The self-managed MySQL database is physically backed up. For more information, see Back up MySQL databases.
  2. Binlog is enabled for the database. The following steps describe how to enable Binlog:
    1. Run the following command to check whether Binlog is enabled for the MySQL database:
      show variables like '%log_bin%'
      Check whether Binlog is enabled
    2. Optional:If Binlog is disabled, run the following command to enable Binlog:
      1. Add the following content to the /etc/my.cnf file:
        log_bin = mysql-bin
        binlog_format = ROW
      2. Run the service mysql start command to restart the MySQL service.

Enable log backup

  1. Log on to the DBS console.
  2. In the left-side navigation pane, click Backup Schedules. On the Backup Schedules page, select a region in the upper-left corner.
    Select a region
  3. On the Backup Schedules page, click Manage in the Actions column corresponding to the ID of the backup schedule based on which you want to create physical backups.
  4. On the Configure Task page, click Incremental log management.
  5. In the Incremental log management dialog box, turn on Log backup.
    Note When Log backup is enabled, Incremental backup is automatically enabled.
  6. Click OK.
  7. In the dialog box that appears, select whether to immediately back up the database.
    • Enable (recommended): DBS immediately starts a full backup and backs up binlogs.
    • Disable: DBS backs up binlogs next time when a full backup is performed.

Restoration

If you enable Log Backup for an instance, you can restore the database to a point in time after you enable Log Backup. For example, if you enable Log Backup on March 1, 2021, you can restore the database to a point in time after March 1, 2021.
Note You can also restore the database to a point in time before you enable Log Backup by using full or incremental backup.

The procedure used to restore a database varies with the restoration methods.

  • Normal restoration:
    1. You can select a point in time in the console to restore a database. DBS restores the data at the specified point in time to the offline directory you specify. For more information, see Restore a database.
    2. Enable the MySQL service.
    3. Optional: If a time difference exists between MySQL and the selected time point, the system generates a file named binlog in the ./_restoration directory_/dbsbinlog directory. Information about the time difference is included in the binlog file. You can manually run binlog by using the Binlog tool provided by MySQL to restore the database to the specified time point.
      Note The directory also contains the help file named ReadMe.txt and the corresponding rollback statements.
  • Restoration from a CMD-based sandbox: You can select a point in time in the console to restore a database. DBS generates a sandbox instance based on the data at the specified point of time. For more information, see Quick start.