All Products
Search
Document Center

PolarDB:Manage a secondary cluster

Last Updated:Jul 25, 2023

A global database network (GDN) consists of multiple PolarDB for MySQL clusters that are deployed in multiple regions within a country. Data is replicated across all clusters in each GDN. This allows applications that are deployed across different regions to access a database that is local to their region, which provides reliable access with low latency. This topic describes how to add a secondary cluster, remove a secondary cluster, switch over a secondary cluster to the primary cluster, and recreate a secondary cluster.

Prerequisites

Create a GDN

Precautions

  • The secondary cluster in a GDN must meet the following requirements:

    • A cluster of PolarDB for MySQL 8.0.2.

    • A cluster of PolarDB for MySQL 8.0.1 whose revision version is 8.0.1.1.17 or later.

    • A cluster of PolarDB for MySQL 5.7 whose revision version is 5.7.1.0.21 or later.

    • A cluster of PolarDB for MySQL 5.6 whose revision version is 5.6.1.0.32 or later.

  • The primary cluster and secondary clusters must have the same database engine version, which can be MySQL 8.0, MySQL 5.7, or MySQL 5.6.
  • You can create only secondary clusters. You cannot specify existing clusters as secondary clusters.

  • When you create a secondary cluster, we recommend that you set the same node specifications as those of the primary cluster to ensure data replication with low latency. You can specify the number of read-only nodes based on read requests to the secondary cluster that is deployed in the same region as the client.

  • A GDN consists of one primary cluster and up to four secondary clusters. For more information about limits on their regions, see Region mappings between the primary and secondary clusters.
    Note To add more secondary clusters, go to Quota Center. Click Apply in the Actions column corresponding to GDN cluster upper limit adjustment.
  • A cluster belongs to only one GDN.
  • Clusters in the GDN do not support specifications of 2 cores and 4 GB of memory or 2 cores and 8 GB of memory.

Pricing

You are not charged for the traffic that is generated during cross-region data transmission within a GDN. You are charged only for the use of PolarDB for MySQL clusters in the GDN. For more information about the pricing rules of PolarDB for MySQL clusters, see Billable items overview.

Add a secondary cluster

  1. Log on to the PolarDB console.
  2. In the left-side navigation pane, click Global Database Network.
  3. Find the GDN to which you want to add a secondary cluster and click Add Secondary Cluster in the Actions column.

    Note

    You cannot specify existing clusters as secondary clusters.

  4. On the buy page, select Subscription or Pay-As-You-Go.

  5. Set the parameters that are described in the following table.

    Parameter

    Description

    Region

    The region where you want to create the secondary cluster. You cannot change the region after the cluster is created.

    Note
    • You can select only a region in the same country as the primary cluster. For more information about the region mappings between the primary and secondary clusters, see Region mappings between the primary and secondary clusters.

    • Make sure that your PolarDB for MySQL cluster and the Elastic Compute Service (ECS) instance to be connected are deployed in the same region. Otherwise, they cannot communicate over an internal network.

    Creation Method

    The type of cluster to be created. Select Create Secondary Cluster.

    GDN

    The GDN in which you want to create a secondary cluster.

    Note

    By default, the GDN that you select before you create the secondary cluster is used.

    Database Engine

    The database engine of the cluster, which must be consistent with the primary cluster. Default value: WAIT. Valid values:

    • MySQL 8.0

    • MySQL 5.7

    • MySQL 5.6

    Product Version

    Enterprise is selected by default.

    Edition

    Only Cluster Edition (Recommended) is supported. You do not need to change this parameter value.

    Nodes

    By default, each cluster of Cluster Edition (Recommended) consists of one primary node and one read-only node. Both of the nodes have the same specifications. You do not need to change this parameter value.

    Note

    If the primary node fails, the system upgrades the read-only node to a primary node and creates another read-only node. For more information about read-only nodes, see Architecture.

    Primary Zone

    The primary zone where the cluster is deployed.

    • A zone is an independent geographical location in a region. All of the zones in a region provide the same level of service performance.

    • You can choose to create a PolarDB for MySQL cluster in the same zone as the ECS instance.

    • You need to specify only the primary zone. The system automatically selects a secondary zone.

    Enable Hot Standby Storage Cluster

    Specifies whether to enable the Hot standby storage cluster feature.

    • When this feature is enabled, the primary cluster and a hot-standby cluster for the primary cluster are deployed in the specified region. The primary cluster contains compute nodes that serve as standbys for each other, and primary storage. The two clusters each have three replicas, which adds up to six replicas. This delivers higher SLA than when this feature is disabled.PolarDB for MySQL

    • When this feature is disabled, only the primary cluster is deployed. The cluster has three replicas, and the storage unit price is half of that when this feature is enabled. This delivers lower SLA than when this feature is enabled.

    Specification Type

    Select General-purpose or Dedicated for PolarDB for MySQL Cluster Edition. Valid values:

    • Dedicated: Computing resources such as CPUs that are allocated to each cluster are exclusive to the cluster. This improves the stability and reliability.
    • General-purpose: Idle computing resources such as CPUs are shared among clusters on the same host for cost-effectiveness.

    For more information about the comparison between the types of specifications, see Comparison between general-purpose and dedicated compute nodes.

    Filter

    The compute node specifications.

    Note

    For more information about the specifications of compute nodes, see Specifications of compute nodes.

    PolarProxy Type

    PolarDB for MySQL supports Standard Enterprise Edition and Dedicated Enterprise Edition.

    • Standard Enterprise Edition: If your cluster is General-purpose, you can select this database proxy type, which shares CPU resources with smart elastic scaling within seconds provided based on business loads.

    • Dedicated Enterprise Edition: If your cluster is Dedicated, you can select this database proxy type, which occupies all allocated CPU resources and provides better stability.

    Note

    PolarProxy Enterprise Edition is currently provided free-of-charge but may charge fees in the future.

    Storage Type

    PolarDB for MySQL supports the PSL5 and PSL4 storage types.

    • PSL5: the storage type supported by historical versions of PolarDB. This was the default storage type for PolarDB clusters purchased before June 7, 2022. It delivers higher performance, reliability, and availability.

    • PSL4: a new storage type for PolarDB for MySQL. Standard Edition uses the Smart-SSD technology developed in-house by Alibaba Cloud to compress and decompress data at the SSD disk level. This storage type can minimize the storage costs of data while maintaining a high disk performance. This storage type is also called PSL4.

      Note

      The storage type of existing clusters cannot be changed to Standard Edition. To use Standard Edition, we recommend that you purchase a new cluster, set the storage type to Standard Edition, and then migrate data to the new cluster.

    For more information about the two storage types, see Comparison between PSL4 and PSL5.

    Storage Billing Method

    PolarDB for MySQL supports the Pay-as-you-go and Subscription billing methods for the storage of your clusters.

    • Pay-as-you-go: The storage capacity is provided based on a serverless architecture. This way, you do not need to specify the storage capacity when you purchase clusters. The storage capacity of the clusters can be automatically scaled up as the volume of data increases. You are charged for the actual data volume. For more information, see Pay-as-you-go.

    • Subscription: You must purchase a specific amount of storage capacity when you create the cluster. For more information, see Subscription.

    Note

    When Product Type is set to Subscription, the Storage Billing Method parameter can be set to Pay-as-you-go or Subscription. When Product Type is set to Pay-as-you-go, the Storage Billing Method parameter is unavailable, and the storage is billed on a pay-as-you-go basis.

    Capacity

    The amount of storage capacity that you want to purchase for your cluster. The value can range from 50 GB to 100 TB, in 5 GB increments.

    Note

    This parameter is available only when Storage Billing Method is set to Subscription.

  6. Click Next: Cluster Configurations and configure the following parameters.

    Parameter

    Description

    Cluster Name

    You can select Auto-generate or Custom cluster name.

    • If you select Auto-generate, the system automatically generates a cluster name after the cluster is created. You can modify the automatically generated cluster name.

    • If you select Custom, you must enter a cluster name. The name must meet the following requirements:

      • It cannot start with http:// or https://.

      • It must be 2 to 256 characters in length.

      • It must start with a letter and can contain letters, digits, periods (.), underscores (_), and hyphens (-).

    Resource Group

    Select a resource group from the available resource groups. For more information, see Create a resource group.

    Note

    A resource group is a group of resources that belong to an Alibaba Cloud account. Resource groups allow you to manage these resources in a centralized manner. A resource belongs to only one resource group. For more information, see Use RAM to create and authorize resource groups.

    Network Type

    This parameter can be set only to VPC. You do not need to change this parameter value.

    Make sure that the PolarDB for MySQL cluster is created in the same VPC as the ECS instance from which the cluster is connected. Otherwise, the cluster and the ECS instance cannot communicate over the internal network to achieve optimal performance.

    • If an existing VPC meets your network requirements, select the VPC. For example, if you have created an ECS instance and the VPC to which the ECS instance is connected meets your network requirements, select this VPC.

    • If you have not created a VPC that meets your network plan, you must create one. For more information, see the "Create and manage a VPC" section of the SQL editor topic.

    Parameter Template

    Select a custom or default system parameter template.

    Note
    • Only parameter templates of PolarDB for MySQL 8.0 are supported.

    • In the parameter template drop-down list, all custom or default system parameter templates available in the current region are displayed. For more information about parameter templates, see Apply a parameter template.

    Time Zone

    The time zone of the cluster. The default value is UTC+08:00.

    Table Name Case Sensitivity

    Specifies whether table names are case-sensitive. The default value is Not Case-sensitive. If the table names of your on-premises database are case-sensitive, we recommend that you select Case-sensitive. This ensures that data is migrated smoothly.

    Note

    After the cluster is created, you cannot change the value of this parameter. We recommend that you configure this parameter based on your business requirements.

    Release Cluster

    The backup retention policy that is used when the cluster is deleted or released. The default value is Retain Last Automatic Backup (Automatic Backup before Release) (Default).

    • Retain Last Automatic Backup (Automatic Backup before Release) (Default): The system retains the last backup when you release the cluster.

    • Retain All Backups: The system retains all backups when you release the cluster.

    • Delete All Backups (Cannot be restored): The system retains no backups when you release the cluster.

    Note

    You may be charged for the backups that are retained after you delete or release a cluster. For more information, see Release a cluster.

  7. Click Next: Confirm Order.

  8. On the Confirm Order page, confirm your order information. Read and accept the terms of service, and then click Buy Now.

  9. On the Purchase page, confirm the order and the payment method, and click Purchase.

    After you complete the payment, it requires 10 to 15 minutes to create the cluster. Then, the newly created cluster is displayed on the Clusters page.

    Note
    • If nodes in your cluster are in the Creating state, the cluster is being created and unavailable. The cluster is available only when it is in the Running state.

    • Make sure that you have selected the region where the cluster is deployed. Otherwise, you cannot view the cluster.

    • We recommend that you purchase subscription PolarDB for MySQL storage plans to store a large amount of data. Storage plans are more cost-effective than pay-as-you-go storage. You are offered larger discounts if you purchase storage plans that provide larger storage capacities. For more information, see Combination with storage plans.

Remove a secondary cluster

  1. Log on to the PolarDB console.
  2. In the left-side navigation pane, click Global Database Network.
  3. Find the GDN and click GDN ID/Name.

  4. In the Clusters section, find the Secondary Cluster that you want to remove and click Detach in the Actions column.

    Note
    • It requires about five minutes to remove a secondary cluster.

    • During this process, the endpoints of all clusters in the GDN (including the secondary cluster that is being removed) are available. You can still use the endpoints to access databases.

    • Only secondary clusters can be removed from a GDN. The primary cluster cannot be removed from a GDN.

    • After a secondary cluster is removed from a GDN, the secondary cluster stops replicating data from the primary cluster. In this case, the secondary cluster is set to the read/write mode.

    • After a secondary cluster is removed from a GDN, the cluster can no longer be used as a secondary cluster for the GDN. Proceed with caution.

  5. In the message that appears, click OK.

Switch the primary cluster

  1. Log on to the PolarDB console.
  2. In the left-side navigation pane, click Global Database Network.
  3. Find the GDN and click GDN ID/Name.

  4. In the Clusters section, click Switch to Primary Cluster in the Actions column. Or click Primary/Secondary Switchover in the upper-right corner of the Clusters section.

    Primary/Secondary Switchover
  5. In the Primary/Secondary Switchover dialog box, select the ID of the secondary cluster as the new primary cluster and click OK.

    Note
    • If you have applied for a public endpoint for the GDN, make sure that the new primary cluster also has a public cluster endpoint. Otherwise, applications cannot access the databases. For more information, see View the endpoint and port number.

    • When you switch over the primary cluster, services may be interrupted for up to 160 seconds. We recommend that you perform this operation during off-peak hours and make sure that your application is configured to automatically reconnect to the cluster.

    • Forced switchover is in the canary release phase. To apply for a trial, go to the Quota Center. Click Apply in the Actions column corresponding to PolarDB GDN master-slave forced switching trial. After the trial application is approved and if you turn on the Forced Switchover switch in the Primary/Secondary Switchover dialog box,

      • If the switchover is performed by force, the cluster that is promoted as the new primary cluster cannot be specified. By default, the secondary cluster with the largest LSN is forcibly promoted as the new primary cluster.

      • If you switch over the clusters by force, data may be lost during the switchover. After the clusters are switched over, the original primary cluster is automatically removed. Proceed with caution.

Recreate a secondary cluster

Note
  • Recreating a secondary cluster is in the canary release phase. To apply for a trial, go to the Quota Center. Click Apply in the Actions column corresponding to PolarDB GDN re-hitch trial from cluster.

  • If you recreate a secondary cluster, the cluster is unavailable until it is completely recreated. Exercise caution when you recreate a secondary cluster.

  1. Log on to the PolarDB console.
  2. In the left-side navigation pane, click Global Database Network.

  3. Find the GDN and click GDN ID/Name.

  4. In the Clusters section, click the More icon icon in the Actions column and select Recreate Secondary Cluster.

    Recreate Secondary Cluster
  5. In the Recreate Secondary Cluster message, click OK.