This topic describes how to restore a full backup of a PolarDB for MySQL cluster to a new cluster by using different methods.

Restoration methods

You can use the following methods to restore data in a PolarDB for MySQL cluster to a new cluster or the original cluster based on your business requirements.

  • Method 1: Restore a full backup to a new cluster.

    Restore all data of the original cluster to a new cluster. After you verify the restored data on the new cluster, migrate the data from the new cluster back to the original cluster. This topic describes how to restore data by using this method.

    Note Only the data and account information of the original cluster are restored to the new cluster. The parameters of the original cluster are not restored to the new cluster.
  • Method 2: Restore data of specified databases or tables to the original cluster.

    For example, in gaming business, you need to restore the data of only one or more players. For more information, see Restore data of specific databases and tables.

    Note This method is supported by only clusters of PolarDB for MySQL 5.6.

Restore data to a specified point in time

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then click the cluster ID.
  4. In the left-side navigation pane, choose Settings and Management > Backup and Restore.
  5. On the Backup and Restore page, click Point-in-time Restore.
    1
  6. On the Clone Instance page, select a billing method for the new cluster.
    • Subscription: If you use this billing method, you must pay for the compute nodes when you create a cluster. By default, a primary node and a read-only node are included if the Product editions of the original cluster is Cluster Edition. You are charged for the storage based on the actual data volume. The storage fee is deducted from your account balance on an hourly basis.
    • Pay-as-you-go: If you use this billing method, you only pay for the used resources, including the compute nodes and the used storage. The fees are deducted from your account balance on an hourly basis.
  7. On the page that appears, specify the following parameters.
    Parameter Description
    Clone Source Type Select Backup Timepoint.
    Backup Timepoint Select the point in time to which you want to restore the cluster.
    Note You can restore the cluster to a point in time only within the last seven days.
    Region By default, the region of the original cluster is selected. You do not need to change the region.
    Primary Availability Zone Select the primary zone where the cluster is deployed.
    Note In regions that contain two or more zones, PolarDB automatically replicates the data to the secondary zone for disaster recovery.
    Network Type The type of the network. This parameter is automatically set to VPC. You do not need to change the value.
    VPC Select a VPC and a vSwitch for the cluster. We recommend that you use the same VPC and vSwitch that are used for the original cluster.
    Note Make sure that the PolarDB cluster and the Elastic Compute Service (ECS) instance to be connected are deployed in the same VPC. Otherwise, the cluster and the ECS instance cannot communicate over the internal network. This decreases the performance.
    VSwitch
    Compatibility The default value of this parameter is the same as the compatibility of the original cluster. You do not need to change the value.

    For example, if the compatibility of the original cluster is MySQL 8.0 (fully compatible with MySQL 8.0), the Compatibility parameter is also set to MySQL 8.0.

    Edition The default value of this parameter is the same as the edition of the original cluster. You do not need to change the value.

    For example, if the Edition of the original cluster is Cluster (2-16 Nodes) (Recommended), the Edition parameter is also set to Cluster (2-16 Nodes) (Recommended). For more information, see Product editions.

    Node Specification Select a node specification. The maximum storage capacity and the performance of clusters vary based on the node specifications. For more information, see Node specifications.
    Note We recommend that you select a node specification that is higher than the node specification of the original cluster. This ensures that the new cluster can run as expected.
    Nodes
    • If the Edition of the original cluster is Cluster (2-16 Nodes) (Recommended), the default number of nodes is 2. You do not need to change the value.
      Note By default, a new Cluster Edition cluster contains one primary node and one read-only node. After the cluster is created, you can add nodes to the cluster. A cluster can contain one primary node and up to 15 read-only nodes. For more information about how to add a node, see Add or remove read-only nodes.
    • If the Edition of the original cluster is Single Node or Archive Database, the default number of nodes is 1. You do not need to change the value.
    Storage Cost You do not need to select the storage capacity when you purchase PolarDB clusters. You are charged for the used storage on an hourly basis. You can also purchase a storage plan based on your business requirements. For more information about how to purchase a storage plan , see Purchase a storage plan.
    Cluster Name The name of the cluster. The name must meet the following requirements:
    • It cannot start with http:// or https://.
    • It must be 2 to 256 characters in length.

    If you do not specify this parameter, the system automatically generates a cluster name. You can change the cluster name after the cluster is created.

    Purchase Plan Specify Purchase Plan for the cluster.
    Note This parameter is available only when the Billing Method parameter is set to Subscription.
    Number Specify Number for the cluster.
  8. Read and accept the terms of the service agreement, and then click Buy Now.

Restore data from a backup set (snapshot)

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then click the cluster ID.
  4. In the left-side navigation pane, choose Settings and Management > Backup and Restore.
  5. Find the backup set (snapshot) and click Restore to New Cluster in the Actions column.
    2
  6. On the Clone Instance page, select a billing method for the new cluster.
    • Subscription: If you use this billing method, you must pay for the compute nodes when you create a cluster. By default, a primary node and a read-only node are included if the Product editions of the original cluster is Cluster Edition. You are charged for the storage based on the actual data volume. The storage fee is deducted from your account balance on an hourly basis.
    • Pay-as-you-go: If you use this billing method, you only pay for the used resources, including the compute nodes and the used storage. The fees are deducted from your account balance on an hourly basis.
  7. On the page that appears, specify the following parameters.
    Parameter Description
    Clone Source Type Select Backup set.
    Clone Source Backup Set Select the backup set from which you want to restore data.
    Note The Start Time of each backup set is displayed. You can determine whether to select the backup set based on this time.
    Region By default, the region of the original cluster is selected. You do not need to change the region.
    Primary Availability Zone Select the primary zone where the cluster is deployed.
    Note In regions that contain two or more zones, PolarDB automatically replicates the data to the secondary zone for disaster recovery.
    Network Type The type of the network. This parameter is automatically set to VPC. You do not need to change the value.
    VPC Select a VPC and a vSwitch for the cluster. We recommend that you use the same VPC and vSwitch that are used for the original cluster.
    Note Make sure that the PolarDB cluster and the ECS instance to be connected are deployed in the same VPC. Otherwise, the cluster and the ECS instance cannot communicate over the internal network. This decreases the performance.
    VSwitch
    Compatibility The default value of this parameter is the same as the compatibility of the original cluster. You do not need to change the value.

    For example, if the compatibility of the original cluster is MySQL 8.0 (fully compatible with MySQL 8.0), the Compatibility parameter is also set to MySQL 8.0.

    Edition The default value of this parameter is the same as the edition of the original cluster. You do not need to change the value.

    For example, if the Edition of the original cluster is Cluster (2-16 Nodes) (Recommended), the Edition parameter is also set to Cluster (2-16 Nodes) (Recommended). For more information, see Product editions.

    Node Specification Select a node specification. The maximum storage capacity and the performance of clusters vary based on the node specifications. For more information, see Node specifications.
    Note We recommend that you select a node specification that is higher than the node specification of the original cluster. This ensures that the new cluster can run as expected.
    Nodes
    • If the Edition of the original cluster is Cluster (2-16 Nodes) (Recommended), the default number of nodes is 2. You do not need to change the value.
      Note By default, a new Cluster Edition cluster contains one primary node and one read-only node. After the cluster is created, you can add nodes to the cluster. A cluster can contain one primary node and up to 15 read-only nodes. For more information about how to add a node, see Add or remove read-only nodes.
    • If the Edition of the original cluster is Single Node or Archive Database, the default number of nodes is 1. You do not need to change the value.
    Storage Cost You do not need to select the storage capacity when you purchase PolarDB clusters. You are charged for the used storage on an hourly basis. You can also purchase a storage plan based on your business requirements. For more information about how to purchase a storage plan , see Purchase a storage plan.
    Cluster Name The name of the cluster. The name must meet the following requirements:
    • It cannot start with http:// or https://.
    • It must be 2 to 256 characters in length.

    If you do not specify this parameter, the system automatically generates a cluster name. You can change the cluster name after the cluster is created.

    Purchase Plan Specify Purchase Plan for the cluster.
    Note This parameter is available only when the Billing Method parameter is set to Subscription.
    Number Specify Number for the cluster.
  8. Read and accept the terms of the service agreement, and then click Buy Now.

Log on to the new cluster and verify the data

For more information about how to log on to a cluster, see Connect to a PolarDB for MySQL cluster.

Migrate data to the original cluster

After you verify the data on the new cluster, you can migrate the data from the new cluster back to the original cluster. For more information, see Migrate data between PolarDB for MySQL clusters.

Note Data is replicated from the source cluster to the destination cluster during data migration. During the data migration, your services in the source cluster are not affected.

FAQ

  • How do I restore a database that I accidentally deleted?

    PolarDB for MySQL allows you to restore the database that you accidentally deleted. For more information, see Restore data of specific databases and tables. If your cluster does not support the restoration of individual databases and tables, you can restore the full data to a new cluster. After you verify the data on the new cluster, migrate the restored data from the new cluster back to the original cluster.

  • If a data backup of my cluster does not exist, can I restore the data to a point in time?

    No, you cannot restore the data of your cluster to a point in time if a data backup of your cluster does not exist. To restore data to a specific point in time, you must first restore the data of a full backup that was generated before the specified point in time. Then, you must restore the incremental data to the specific point in time based on the binary logs.

References

Back up data

Related API operations

API Description
CreateDBCluster Restores the data of a PolarDB cluster.
Note You must set CreationOption to CloneFromPolarDB.