Help Center/ Document Database Service/ User Guide (Kuala Lumpur Region)/ Instance Management/ Manually Switching the Primary and Secondary Nodes of a Replica Set
Updated on 2022-08-17 GMT+08:00

Manually Switching the Primary and Secondary Nodes of a Replica Set

Scenarios

A replica set consists of the primary node, secondary node, and hidden node. Primary and secondary nodes allow access from external services by providing IP addresses. Hidden nodes are only used for backing up data. When a primary node becomes faulty, the system automatically selects a new primary node to ensure high availability. In addition, DDS supports the primary/secondary switchover so you can perform switchovers in scenarios such as disaster recovery.

  • You can perform a switchover when the DB instance status is Available, and Changing a security group.
  • The database connection may be interrupted during the switchover. Ensure that your client supports reconnection.
  • The longer the delay for primary/secondary synchronization, the more time is needed for a primary/secondary switchover. Therefore, if the primary to secondary synchronization delay exceeds 300s, the primary/secondary switchover is not allowed. For details about the synchronization delay, see What Is the Time Delay for Primary/Secondary Synchronization in a Replica Set?

Procedure

  1. Log in to the DDS console.
  2. On the Instance Management page, click the target replica set instance.
  3. In the Node Information area on the Basic Information page, click Switch.
  4. In the displayed dialog box, click Yes.
  5. Check the result.

    • During the switchover process, the DB instance status changes to Switchover in progress. After the switchover is complete, the status is restored to Available.
    • In the Node Information area, you can view the switchover result.
    • After the switchover, the previous primary node becomes the secondary node. You need to reconnect to the primary node. For details, see Connecting to a Replica Set Instance Over Private Networks.