A global database network (GDN) consists of PolarDB clusters that are distributed across regions around the world. Data is synchronized across all the clusters in each GDN. If your services are deployed in multiple regions, you can use GDNs to allow the applications to gain instant and reliable access to the databases. This topic describes how to create a GDN and add a secondary cluster.

Prerequisites

  • The version of the PolarDB cluster is PolarDB for MySQL 8.0.
  • A primary PolarDB cluster is created. For more information about how to create a PolarDB cluster, see Create a PolarDB for MySQL cluster.
  • The kernel minor version of the primary cluster is the latest version. For more information about version upgrades, see Upgrade the revision version.

Read and write splitting supported by GDNs

In most cases, multinational corporations run their services in multiple regions and deploy databases in a central region. If all the applications around the world access the databases in the central region, network latency occur for cross-region access requests. This may compromise the system performance and affect the user experience. To resolve this issue, each GDN uses the asynchronous replication mechanism to transfer data from the primary cluster to the secondary clusters. This allows data to be synchronized across clusters and reduces the latency to less than two seconds. This way, applications in non-central regions can retrieve data from the nearest secondary clusters at a high rate.

1

GDNs also support the read/write splitting feature for all the clusters. This feature allows you to create a secondary cluster in each of up to five non-central regions. When applications in these regions send requests to the databases, your GDN forwards the read requests to the secondary cluster in the same region as the applications. Your GDN also forwards the write requests to the primary cluster that is deployed in the central region. GDNs provide an easy method for you to build a global architecture for your services. You do not need to modify the code of your applications to implement read/write splitting.

1

Notes

  • A GDN consists of one primary cluster and a maximum of four secondary clusters.
  • The primary cluster and secondary clusters in each GDN are independent of each other. You can specify different specifications, whitelists, and parameter values for the primary cluster and the secondary clusters.
  • A cluster can belong to only one GDN.
  • A GDN can cover a maximum of five regions. Multiple clusters can reside in the same region or zone.
  • You cannot add existing clusters as secondary clusters. To use secondary clusters, you must create clusters and specify them as the secondary clusters.

Pricing

The GDN feature is available free of charge. You are billed for only each PolarDB cluster that uses the GDN feature. For more information about the prices of PolarDB clusters, see Specifications and pricing of compute nodes.

Results of performance tests

PolarDB GDN supports the asynchronous replication mechanism to copy data across regions. GDN can reduce replication latency by using technologies such as physical logs and concurrent processing. If you create secondary clusters and synchronize data, the stability and performance of the primary cluster is not affected.

Specification and topology of the test cluster SysBench stress testing Peak QPS/TPS The latency between the secondary cluster in the US (Silicon Valley) region and the primary cluster in the China (Zhangjiakou) region
GDN that covers the China (Zhangjiakou) region and the US (Silicon Valley) region

PolarDB for MySQL

16 Core - 128 GB

OLTP_INSERT 82655/82655 Less than 1s
OLTP_WRITE_ONLY 157953/26325 Less than 1s
OLTP_READ_WRITE 136758/6837 Less than 1s

Create a GDN

  1. Log on PolarDB console.
  2. In the left-side navigation pane, click Global Database Network.
  3. On the Global Database Network page, click Create GDN.
    1
  4. In the Create GDN dialog box, specify the following parameters:
    Parameter Description
    Name The name of the GDN that you want to create. The name can be used to identify your business and does not need to be unique.
    Primary Region The region where the primary cluster resides.
    Note Select the primary cluster and the region where the primary cluster resides.
    Primary Cluster The primary cluster.
    Note The version of the primary cluster must be PolarDB for MySQL 8.0.
  5. After you configure the preceding parameters, click OK.

Create a secondary cluster

  1. Log on PolarDB console.
  2. In the left-side navigation pane, click Global Database Network.
  3. Find the name of the GDN where you want to create a secondary cluster. Then, in the Actions column for the GDN, click Add Secondary Cluster.
    1
    Note You cannot add an existing cluster as a secondary cluster in a GDN.
  4. On the buy page that appears, select Subscription or Pay-As-You-Go.
    • Subscription: An upfront payment is required for the compute nodes when you create the cluster. You are charged for the consumed storage space by hour. The charges are deducted from your account balance on an hourly basis.
    • Pay-As-You-Go: If you use the pay-as-you-go billing method, you pay for the resources after you use them. You are charged for the compute nodes and the consumed storage space by hour. The charges are deducted from your account balance on an hourly basis.
  5. Set the following parameters:
    Parameter Description
    Region The region where the cluster resides. You cannot change the region after the cluster is created.
    Note Make sure that the PolarDB cluster and the Elastic Compute Service (ECS) instance to be connected are deployed in the same region. Otherwise, the cluster and the ECS instance cannot communicate through the internal network and can communicate through only the Internet. This compromises the performance of the cluster.
    Create Type The type of the 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 is the one that you select before you create the secondary cluster.
    Primary Availability Zone The primary zone where the cluster is deployed.
    • Each zone is an independent geographical location that resides in a region. All the zones in a region provide the same services.
    • You can deploy your PolarDB cluster and ECS instance in the same zone or in different zones.
    • You need only to select the primary zone. The system automatically selects a secondary zone.
    Network Type The type of the network. The value of this parameter is set to VPC. You do not need to set this parameter.
    Note Before you use the classic network, you must select a virtual private cloud (VPC). After the cluster is created, configure the classic network. For more information, see VPC-facing endpoints and public-facing endpoints.
    VPC

    VSwitch

    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 compromises performance.
    • If you have created a VPC that meets your network plan, select the VPC. For example, if you have created an ECS instance and the VPC where the ECS instance resides meets your network plan, select this VPC.
    • Otherwise, use the default VPC and the default VSwitch.
      • Default VPC:
        • The default VPC is a unique VPC in the selected region.
        • The subnet mask for the default VPC consists of 16 bits, such as 172.31.0.0/16. A maximum of 65,536 private IP addresses can be provided.
        • The default VPC is not included in the total number of VPCs that you can create.
      • Default VSwitch:
        • The default VSwitch is a unique VSwitch in the selected zone.
        • The subnet mask for the default VSwitch consists of 20 bits, such as 172.16.0.0/20. A maximum of 4,096 private IP addresses can be provided.
        • The default VSwitch is not included in the total number of VSwitches that you can create in a VPC.
    • If the default VPC and VSwitch cannot meet your business requirements, you can create your own VPC and VSwitch. For more information, see Create a VPC.
    Compatibility Only MySQL 8.0 is supported. Use the default setting. You do not need to set the parameter.
    Edition Only Standard (2-16 Nodes) (Recommended) is supported. Use the default setting. You do not need to set the parameter.
    Node Specification The node specification of the cluster. Select the specifications based on your business requirements. All the nodes in each PolarDB cluster are exclusive nodes that provide stable and reliable performance. For more information about node specifications, see Specifications and pricing.
    Nodes The number of nodes in the secondary cluster. By default, each Standard (2-16 Nodes) (Recommended) cluster consists of one primary node and one read-only node. The specifications of the read-only node are the same as those of the primary node. Use the default setting. You do not need to specify the parameter.
    Note If the primary node fails, the system uses the read-only node as the primary node and generates another read-only node. For more information about read-only nodes, see Architecture.
    Storage Cost The storage cost. You do not need to set this parameter. You are charged for the used storage space on an hourly basis. For more information, see Specifications and pricing.
    Note You do not need to select a storage capacity when you create a cluster. The system automatically scales the storage capacity based on the amount of data to be stored.
    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 table names are case-sensitive in your on-premises database, we recommend that you select Case-sensitive. This ensures that you can migrate data in an easy way.
    Note The value of this parameter cannot be changed after the cluster is created. Proceed with caution.
    Release Cluster The backup retention policy that is used after the cluster is deleted or released. The default value is Retain Last Automatic Backup (Automatic Backup before Release).
    • Retain Last Automatic Backup (Automatic Backup before Release): retains the last backup after you delete the cluster.
    • Retain All Backups: retains all backups after you delete the cluster.
    • Delete All Backups (Cannot be restored): retains no backups after you delete the cluster.
    Note If you need to retain backups after you delete or release the instance, you may need to pay a few fees. You can delete the backups to reduce costs. For more information, see Data backup pricing.
    Cluster Name
    • The name of the new cluster. The cluster name must be 2 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-).
    • If you leave this parameter empty, the system automatically generates a cluster name. You can change the cluster name after the cluster is created.
    Resource Group The resource group of the cluster. Select a resource group from available resource groups. For more information about how to create a resource group, see Create a resource group.
    Note A resource group is a container that contains a group of resources in an Alibaba Cloud account. You can perform centralized management on these resources. A resource belongs to only one resource group. For more information, see Use RAM to create and authorize resource groups.
  6. If you create a subscription cluster, set the Purchase Plan and Number parameters, and then click Buy Now in the right corner.
  7. On the Confirm Order page, confirm your order information. Read the terms of the service agreement, select the check box, and click Buy Now.
  8. On the Purchase page, confirm the unpaid order and the payment method and click Purchase.
  9. After you complete the payment, wait for 10 to 15 minutes. Then, you can view the newly created cluster on Clusters.

FAQ

Q: How many GDNs can I create for an Alibaba Cloud account?

A: The number of GDNs that you can create is not limited.