Help Center/ GaussDB(for MySQL)/ User Guide/ Read Replicas/ Adding Read Replicas to a DB Instance
Updated on 2024-11-06 GMT+08:00

Adding Read Replicas to a DB Instance

Scenarios

Read replicas of a DB instance are used to enhance instance capabilities and reduce the read pressure on the primary node. After a DB instance is created, you can add read replicas.

There are synchronous and asynchronous read replicas.

  • Synchronous read replicas: Their failover priority is 1 and specifications are the same as those of the primary node. To avoid failover failures caused by inconsistent specifications between the primary node and read replicas, a DB instance must have a synchronous read replica, and a multi-AZ DB instance must have a synchronous read replica in a different AZ from the primary node.
  • Asynchronous read replicas: Their failover priority is not 1 and specifications are different from those of the primary node.

For more information about read replicas, see Introducing Read Replicas.

Deployment Relationships Between the Primary Node and Read Replicas

  • If you select single-AZ deployment, read replicas are deployed in the same AZ as the primary node.
  • If you select multi-AZ deployment, read replicas are evenly deployed in different AZs to ensure high reliability.

Constraints

  • Each yearly/monthly or pay-per-use DB instance has a maximum of 15 read replicas.
  • Each serverless DB instance has a maximum of 7 read replicas.
  • If all synchronous read replicas are unavailable during a failover, an asynchronous read replica will be promoted to primary.

Procedure

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner of the page and choose Databases > GaussDB(for MySQL).
  4. On the Instances page, locate the instance you want to add read replicas to and choose More > Create Read Replica in the Operation column.
  5. On the displayed page, set required parameters.

    Table 1 Parameter description

    Parameter

    Description

    Billing Mode

    • Pay-per-use DB instance: Pay-per-use and serverless read replicas can be added.
    • Yearly/Monthly DB instance: Yearly/Monthly, pay-per-use, and serverless read replicas can be added.
    • Serverless DB instance: Only serverless read replicas can be added.

    Failover Priority

    Failover priority ranges from 1 for the first priority to 16 for the last priority. This priority determines the order in which read replicas are promoted when recovering from a primary node failure. Read replicas with the same priority have a same probability of being promoted to the new primary node. You can configure a failover priority for up to 9 read replicas, and the default priority for the remaining read replicas is -1, indicating these read replicas cannot be promoted to primary. You can change the failover priority of a read replica.

    NOTE:
    • Serverless DB instance: The failover priority for the primary node can only be 1, while that for a newly added read replica can be 1 to 15.
    • Yearly/Monthly DB instance: When a pay-per-use or serverless read replica is added, the failover priority is -1 by default and cannot be changed.
    • Pay-per-use DB instance: When a serverless read replica is added, the failover priority is -1 by default and cannot be changed.

    AZ

    GaussDB(for MySQL) multi-AZ instances allow you to select an AZ when creating a read replica.

    • If no AZs are specified, the created read replicas are evenly distributed in each AZ.
    • If too many nodes are created in a specified AZ, the read replicas may fail to be created due to insufficient resources.
    NOTE:
    • To specify AZs, submit an application by choosing Service Tickets > Create Service Ticket in the upper right corner of the management console.
    • Serverless DB instances do not allow you to specify AZs for read replicas.

    Instance Specifications

    This parameter is only available for primary/standby DB instances.

    If the failover priority is set to 1, the specifications of read replicas must be the same as those of the primary node.

    Quantity

    A DB instance can contain up to 15 read replicas.

  6. For a yearly/monthly instance, click Next and select a payment mode.
  7. For a pay-per-use instance, click Next.
  8. Check the read replica settings.

    • If you need to modify the settings, click Previous.
    • If you do not need to modify the settings, click Submit.

  9. View the new read replicas in the Node List area of the Basic Information page. You can also promote a read replica to primary or delete a read replica.