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 can be enabled free of charge. After the feature is enabled, you are charged for the backup and storage of binary logs. For more information, see Billing overview.
Preparations
- A self-managed MySQL database is physically backed up. For more information, see Back up MySQL databases.
- The binary logging feature is enabled for the database. To enable the binary logging feature, perform the following steps:
- Run the following command to check whether the binary logging feature is enabled for the MySQL database:
show variables like '%log_bin%';
- Optional:If the binary logging feature is disabled, enable the feature.
- Add the following content to the /etc/my.cnf file:
log_bin = mysql-bin binlog_format = ROW
- Run the
service mysql start
command to restart the MySQL service.
- Add the following content to the /etc/my.cnf file:
- Run the following command to check whether the binary logging feature is enabled for the MySQL database:
Enable incremental log backup
- Log on to the Database Backup (DBS) console.
- In the left-side navigation pane, click Backup Schedules. Then, in the top navigation bar, select a region.
- Find the backup schedule for which you want to enable incremental log backup and click Manage in the Actions column. The Configure Task page appears.
- In the Task Running Information section, click . In the message that appears, click OK.
- The Precheck message appears. After the precheck succeeds, click Start Task or click the icon in the upper-right corner of the message. Note
- If you click Start Task, DBS starts a full backup task and an incremental backup task.
After the full backup task is complete, you can restore the data to a point in time from the completion of the first full backup.
- If you click the icon, DBS does not start a full backup task or an incremental backup task.
The next time a full backup task starts, DBS starts an incremental backup task based on the original scheduling policy of the full backup set. After the full backup task is complete, you can restore the data to a point in time from the completion of the first full backup.
- If the precheck fails, try again as prompted. For more information, see Common Errors and Troubleshooting.
- If you click Start Task, DBS starts a full backup task and an incremental backup task.
Restore a database
Method 1: Regular restoration
- 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.
- Enable the MySQL service.
- 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.
Method 2: 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.