Manually Switching the Primary and Secondary Nodes of a Replica Set
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. DDS supports primary/secondary switchovers for scenarios such as disaster recovery.
Precautions
- To perform a switchover, the instance status needs to be Available, Changing to yearly/monthly, and Changing a security group.
- The database connection may be interrupted during the switchover. Ensure that your client supports reconnection.
- If there are any newly added standby nodes, they will be unable to participate in this switchover. When you add a new standby node, the HA connection address needs to be reconfigured, and the new node is frozen for 12 hours.
- A primary/secondary switchover can be performed only when the DB instance is available.
- The longer the delay for primary/secondary synchronization, the more time is needed for a primary/secondary switchover. If the primary to secondary synchronization delay exceeds 300s, primary/secondary switchover is not supported. For details about the synchronization delay, see What Is the Time Delay for Primary/Secondary Synchronization in a Replica Set?
Performing a Primary/Secondary Switchover
- Log in to the management console.
- Click in the upper left corner and select a region and a project.
- Click in the upper left corner of the page and choose Databases > Document Database Service.
- On the Instances page, click the replica set instance.
- In the Node Information area on the Basic Information page, click Switch.
Figure 1 Primary/Secondary switchover
- In the displayed dialog box, click Yes.
- 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 DB Instance.
Forcibly Promoting a Secondary Node to the Primary
- Log in to the management console.
- Click in the upper left corner and select a region and a project.
- Click in the upper left corner of the page and choose Databases > Document Database Service.
- On the Instances page, locate the target replica set instance and click its name.
- In the Node Information area on the Basic Information page, locate a target node whose role is Secondary and click Promote to Primary in the Operation column.
Figure 2 Promote to Primary
- In the displayed dialog box, click Yes.
Figure 3 Forcibly promoting a secondary node to the primary
- Check the result.
- In the Node Information area on the Basic Information page, you can view the result.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot