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
- 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 log backup
- Log on to the DBS console.
- In the left-side navigation pane, click Backup Schedules. On the Backup Schedules page, select a region in the upper-left corner.
- On the Backup Schedules page, find the ID of your backup schedule and click Manage in the Actions column.
- On the Configure Task page, click Enable Transaction Log Backup.
- In the Incremental log management message, click OK.
- The Precheck dialog box appears. The After the precheck is complete, click Start Task.
Restoration
The procedure that is used to restore a database varies with the restoration methods.
- 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.
- 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.