Database Backup (DBS) allows you to back up binary logs of MySQL databases in addition to full and incremental data. You can use full backups, incremental backups, and log backups to restore a database to a point in time and achieve a recovery point objective (RPO) in seconds.

Billing

The log backup feature is free of charge. You are charged for the backup and storage of binary logs. The billable items are the same as those for MySQL database backups. For more information, see Billing overview.

Preparations

  1. A self-managed MySQL database is physically backed up. For more information, see Back up MySQL databases.
  2. The binary logging feature is enabled for the database. To enable the binary logging feature, perform the following steps:
    1. Run the following command to check whether the binary logging feature is enabled for the MySQL database:
      show variables like '%log_bin%';
    2. Optional:If the binary logging feature is disabled, enable the feature.
      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.
  3. On the Backup Schedules page, find the ID of your backup schedule and click Manage in the Actions column.
  4. On the Configure Task page, click Enable Transaction Log Backup.
  5. In the Incremental log management message, click OK.
  6. The Precheck dialog box appears. The After the precheck is complete, click Start Task.

Restoration

If you enable Transaction Log Backup for a database, you can restore the database to a point in time after the point in time when you enable Transaction Log Backup. For example, if you enable Transaction 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 when a full or incremental backup was performed before the point in time when you enable Transaction Log Backup.

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

  • Regular restoration:
    1. Select a point in time in the DBS console to restore a database. DBS restores the data at the specified point in time to the offline directory that 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 replay the binlog file by using the Binlog tool provided by MySQL to restore the database to the specified point in time.
      Note The directory also contains the help file named ReadMe.txt and the statement for binary log replay.
  • Restoration from a CMD-based sandbox: Select a point in time in the DBS console to restore a database. DBS generates a sandbox instance based on the data at the specified point of time. For more information, see Create a sandbox instance for the emergency disaster recovery of a self-managed database.