All Products
Search
Document Center

Cloud Backup:Back up a MySQL database

更新時間:Dec 05, 2024

To prevent data loss or corruption due to disasters, hardware failures, or accidental deletion, we recommend that you use Cloud Backup to back up your MySQL database in a timely manner. You can use Cloud Backup to back up MySQL databases that are deployed on Elastic Compute Service (ECS) instances or on-premises servers to the cloud. You can restore the data of a MySQL database to the source database, another ECS-hosted database, or an on-premises database within the same region based on recovery points. This topic describes how to back up a MySQL database.

Prerequisites

  • Cloud Backup is activated. You are not charged for activating Cloud Backup. You are charged for using the database backup feature of Cloud Backup based on the following billable items:

    • Rental of database backup vaults. Backup vaults are free of charge for each UID for 30 days. A free capacity of 100 GB is provided for each backup vault per month.

    • Storage usage of database backup vaults. You are charged for the backup storage based on the storage space occupied by the data that is deduplicated and compressed. Backup vaults are free of charge for 30 days. After the free trial period ends, you are charged based on tiered pricing.

    For more information, see Pricing of Cloud Backup.

  • A MySQL database is registered in the Cloud Backup console.

    • Cloud Backup allows you to use the Discover Database feature to discover MySQL databases on the ECS instances where Cloud Assistant Agent is installed. You must obtain the database username and password. For more information, see Register an ECS-hosted MySQL database.

    • For a MySQL database deployed on an on-premises server, you must install a Cloud Backup client on your on-premises server. For more information, see Register an on-premises MySQL database.

  • For an ECS-hosted MySQL database, we recommend that you use the precheck feature to identify issues that may cause backup failure. The check items include Object Storage Service (OSS) connectivity check, control network connectivity check, check of versions that support full backup, and binlog check. For more information, see Precheck an ECS-hosted MySQL database.

Usage notes

  • On-premises database servers must be connected to virtual private clouds (VPCs) by using virtual private networks (VPNs) or Express Connect circuits. You must also make sure that you can use a Cloud Backup client to access one of the following CIDR blocks from an on-premises server: 100.64.0.0/10, 100.64.0.0/11, and 100.96.0.0/11. For more information, see Connect a VPC to a data center in single-tunnel mode.

  • After the anti-ransomware feature is enabled for databases, the MySQL backup feature becomes unavailable. For more information about the anti-ransomware feature, see Overview of the anti-ransomware feature.

  • The MySQL backup feature cannot be used to back up databases deployed in containers.

  • Cloud Backup supports a limited number of database versions, operating systems, and backup features. For example, Cloud Backup does not support backup of a MySQL database deployed on Windows. For more information, see the "Supported database versions" section in Overview (ECS-hosted databases).

  • When you create a backup plan, select a proper backup vault to avoid backing up data from one database to different backup vaults. We recommend that you back up a database instance to only one backup vault. If you back up a database instance to different backup vaults, incremental or log backups may be converted to full backups, which occupies additional storage space in the backup vaults.

  • When you perform incremental backup or log backup by using Cloud Backup, you can also use other backup software or scripts to perform full backup, incremental backup, or log backup. If you use third-party software to perform a full backup, the MySQL database is locked. As a result, the backup job is blocked and delayed. A delay occurs when you perform a full backup in the Cloud Backup console.

  • The MySQL backup feature does not support backing up multiple MySQL databases deployed on a single on-premises server or ECS instance.

Create a backup plan for the MySQL database

After the backup plan is created, the backup plan is in the Running state. Cloud Backup backs up the MySQL database from the specified start time at the specified interval. To create a backup plan, perform the following steps:

  1. Log on to the Cloud Backup console.

  2. In the left-side navigation pane, choose Backup > Database Backup. In the top navigation bar, select a region. On the Database Backup page, click the MySQL tab. Click the ECS Database Instance or Local Database Instance tab. Find the MySQL database for which you want to create a backup plan and click Back Up in the Actions column.

    image

  3. In the Create Backup Plan panel, perform the following steps:

    1. Configure the backup parameters and click Next.

      1. Specify Plan Name.

      2. Select the MySQL database that you want to back up.image.png

    2. Configure the backup plan and click Next.

      Parameter

      Description

      Recommended Plan

      The recommended backup plan. Cloud Backup provides the following preconfigured backup policies. You can select a backup policy based on your business requirements or create a custom backup policy.

      • Typical Plan: enables the Full Backup and Incremental Backup features.

      • Critical Application: enables the Full Backup, Incremental Backup, and Log Backup features.

      • Customize: enables a custom backup policy. You can select incremental backup or real-time backup, and specify the start time and backup interval.

      Full Backup

      If you select Full Backup, all the database files in the operating system are backed up. However, you can restore the files to only the point in time at which the files are backed up.

      You can back up files immediately or at a specified point in time. You can also schedule periodic backups by hour, day, week, or month.

      Incremental Backup

      If you select Incremental Backup, all incremental database files in the operating system are backed up. However, you can restore the files to only the point in time at which the files are backed up.

      You can back up files immediately or at a specified point in time. You can also schedule periodic backups by hour, day, week, or month.

      Important
      • If your MySQL database (earlier than MySQL 5.5) uses the MyISAM engine, you cannot perform incremental backup for the database. In this case, Cloud Backup still performs full backups even if you select Cumulative Incremental Backup for this parameter.

      • To restore an incremental backup file, Cloud Backup must obtain the most recent full backup file. Therefore, the full backup file is not recycled until the incremental backup file expires. We recommend that you configure a reasonable backup cycle and expiration time. For more information, see How does Cloud Backup clear expired database backup files?

      Log Backup

      You can back up database logs at a regular interval.

      You can back up files immediately or at a specified point in time. You can also schedule periodic backups by hour, day, week, or month.

      Important

      To restore a log backup file, Cloud Backup must obtain the most recent full backup file. Therefore, the full backup file is not recycled until the log backup file expires. We recommend that you configure a reasonable backup cycle and expiration time. For more information, see How does Cloud Backup clear expired database backup files?

      Realtime Backup

      If you select Realtime Backup, database logs are backed up in real time.

      Before you enable real-time backup, you must perform a full backup. After real-time backup is enabled, database logs are continuously backed up. Therefore, the recovery point objective (RPO) of data backups can be reduced to seconds. During the free trial period, you can perform real-time backups free of charge. When the free trial period expires, you are charged for the storage usage of real-time backups. For more information, see Pricing of Cloud Backup.

      Important

      You can create only one backup plan for a single MySQL database if you enable real-time backup for the backup plan.

    3. Configure the backup settings and click Next.

      Parameter

      Description

      Concurrent Threads

      The number of concurrent threads that are used to back up files.

      Retry Time

      The time interval between two consecutive reconnection attempts if the database is disconnected during backup. Unit: minutes.

      Speed Limit

      The maximum size of data that is backed up per second. Unit: MB/s.

      Note

      The value 0 indicates that the backup speed is not limited.

    4. Configure a backup vault. Click OK.

      Important

      You can back up a database instance to only one backup vault.

      Parameter

      Description

      Backup Vault

      The backup vault to which you want to store the backup data. Valid values:

      • Create Vault: If you select this option, specify a name for the backup vault in the Vault Name field. If you do not configure this parameter, a random name is specified.

      • Select Vault: If you select this option, select a backup vault from the Vault Name drop-down list.

      Important

      After a backup vault is created, you are charged for the backup vault regardless of whether backup data is generated. For more information, see Billing methods and billable items.

      To maximize the redundancy of your backup data, Cloud Backup uses zone-redundant storage (ZRS)-enabled backup vaults by default in regions that support ZRS-enabled backup vaults. For regions that support only locally redundant storage (LRS)-enabled backup vaults, Cloud Backup uses LRS-enabled backup vaults. You do not need to manually select a backup vault type.

      Vault Name

      The name of the backup vault.

      Backup Retention Period

      The retention period of the backup data. Unit: days, weeks, months, or years.

      You can change the retention period on the Storage Vaults page. This change takes effect on all newly generated backup data in the backup vault. Data is automatically deleted when the retention period expires.

      Important

      To restore an incremental backup file or log backup file, Cloud Backup must obtain the most recent full backup file. Therefore, the full backup file is not recycled until the incremental backup file or log backup file expires. We recommend that you configure a reasonable backup cycle and expiration time. For more information, see How does Cloud Backup clear expired database backup files?

      The backup plan is created.

Backup is successful

  • A full backup is a prerequisite for an incremental backup. You must manually perform a full backup.

  • After the backup plan is created, you can view the backup plan details on the Backup Plans tab. The details include the next execution time and backup intervals for the full backup, incremental backup, and log backup. Cloud Backup backs up the MySQL database from the specified start time at the specified interval.

  • When the backup execution time is reached, Cloud Backup runs the backup plan. If the Status of a backup job is Idle and the time for Next Run is displayed, the backup job is completed.

image.png

FAQ

More operations

On the Backup Plan tab, find the backup plan. In the Actions column, you can perform the following operations:

  • Modify a backup plan

    If a backup plan cannot meet your requirements, you can click Edit to modify the backup plan.

  • Configure alert settings

    You can choose More > Alert Settings in the Actions column and then select a backup alert policy. The following table describes the alert policies.

    Alert policy

    Description

    Disabled

    The Cloud Backup client does not send alert notifications.

    Same as Backup Vault

    The Cloud Backup client sends alert notifications by using the same method configured for the backup vault.

    Default

    The Cloud Backup client sends alert notifications to the owner of the Alibaba Cloud account by using emails.

    Custom

    If you select this option, you must select one or more alert contacts or alert contact groups. If an alert is triggered, the Cloud Backup client sends alert notifications to the selected alert contacts or alert contact groups.

  • Delete a backup plan

    If you delete a backup plan, all backup and restore jobs that are being performed by the client fail.

    To delete a backup plan, find the backup plan and choose More > Delete Backup in the Actions column.

What to do next

Restore a MySQL database

References