Manually Switching the Primary and Secondary Nodes of a Cluster
A cluster instance consists of a config node, and multiple dds mongos and shard nodes. Each shard or config is deployed as a three-node replica set including primary, secondary, and hidden nodes. Primary and secondary nodes do not provide IP addresses for external access. 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, Abnormal, Changing to yearly/monthly, Changing a security group, or Heavy load.
- 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. 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 for a Config Node
- 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 cluster instance name.
- In the Node Information area on the Basic Information page, click the config tab and click Switch in the Operation column.
Figure 1 Primary/Secondary switchover
- In the displayed dialog box, click Yes.
Figure 2 Performing a primary/secondary switchover for a config node
- 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.
Performing a Primary/Secondary Switchover for a Shard Node
- 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 cluster instance name.
- In the Node Information area on the Basic Information page, click the shard tab, locate a target shard node, and choose More > Switch in the Operation column.
Figure 3 Primary/Secondary switchover
- In the displayed dialog box, click Yes.
Figure 4 Performing a primary/secondary switchover for a shard node
- 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, click the cluster instance name.
- In the Node Information area on the Basic Information page, click the config or shard tab, locate the node whose role is Secondary, and click Promote to Primary.
Figure 5 Promote to Primary
- In the displayed dialog box, click Yes.
Figure 6 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