Help Center> GaussDB(for MySQL)> User Guide> Read Replicas> Promoting a Read Replica to the Primary Node
Updated on 2024-05-21 GMT+08:00

Promoting a Read Replica to the Primary Node

A GaussDB(for MySQL) instance consists of a primary node and multiple read replicas. In addition to automatic failover scenarios, you can perform a manual switchover to promote a read replica to the new primary node.

Manual Switchover

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and a project.
  3. Click in the upper left corner of the page, choose Databases > GaussDB(for MySQL).
  4. On the Instances page, click the instance name to go to the Basic Information page.
  5. In the Node List area, locate the read replica to be promoted and click Promote to Primary in the Operation column.

    Figure 1 Promoting a read replica to the new primary node

  6. On the displayed dialog box, click Yes.

    • During a manual switchover, there may be a brief disconnection lasting about 30 seconds. Ensure that your applications support automatic reconnection.
    • During a manual switchover, the DB instance status is Promoting to primary and this process takes several seconds or minutes.
    • After a switchover is complete, the node types of the original primary node and read replica have been exchanged, and the read replica status changes to Available.
      • A read replica whose failover priority is -1 cannot be promoted to the primary node.
      • Services may be intermittently interrupted for several seconds or minutes when a read replica is promoted to the primary node.
      • Promoting a read replica to primary will switch over the private IP addresses for read of the primary node and read replica. To ensure the services are not interrupted, connect to your DB instance using the private IP address from the Network Information area in the Basic Information page or the proxy address from the Database Proxy page. For details about the differences between the two addresses, see Description of Each IP Address.

Automatic Failover

GaussDB(for MySQL) uses a high availability active-active architecture that automatically fails over to a read replica automatically selected by the system.

Each read replica has a failover priority that determines which read replica is promoted if the primary node fails.

  • Priorities range from 1 for the highest priority to 16 for the lowest priority.
  • If two or more read replicas share the same priority, they have a same probability of being promoted to the new primary node.

GaussDB(for MySQL) selects a read replica and promotes it to the new primary node as follows:

  1. Read replicas available for promotion are identified.
  2. One or more read replicas with the highest priority are identified.
  3. One of the read replicas with the highest priority is selected and promoted. If the promotion fails due to network faults or abnormal replication status, GaussDB(for MySQL) attempts to promote another read replica by priority and repeats the process until a read replica is successfully promoted.