tencent cloud

TencentDB for MongoDB

Promoting Secondary Node to Primary Node

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-10-22 17:17:46
Traduzido por IA

Overview

Promoting a secondary node to primary (commonly known as "active switchover" or "forced switchover") is a critical operation in MongoDB Ops. It is primarily used to proactively adjust the cluster architecture in specific scenarios to ensure business continuity and data service stability.
Address primary node performance bottlenecks
The current primary node has a performance bottleneck due to excessive load, while a secondary node with better performance and lower load is more suitable for taking over the primary role. By performing a manual switchover and transferring the primary role to a healthier secondary node, you can quickly relieve performance pressure and restore database write and read performance.
Planned Maintenance or Upgrade
When the underlying infrastructure of the current primary node requires maintenance or upgrade, or when the node is predicted to become unstable, proactively promote a secondary node to primary. This transfers business traffic away from the node under maintenance, enabling maintenance with zero downtime or minimal interruption and ensuring that business is not affected by underlying Ops activities.
Optimize cluster network latency
In a multi-AZ deployment scenario, if the business application is in the same AZ as a secondary node, the network latency to that secondary node is significantly lower than to the current primary node. Promoting this low-latency secondary node to primary can optimize write latency and improve overall business responsiveness.
Disaster Recovery Drill and High Availability Verification
To verify whether the cluster's high availability mechanism is effective or to conduct regular disaster recovery drills, you can manually perform a switchover to verify the integrity of the failover process and the reconnection mechanism of the application, ensuring that the system can recover as expected when a real failure occurs.

Version description

MongoDB 3.2 and later versions support promoting a secondary node to primary.

Operation Impact

Impact
Description
Service Impact
A primary node switchover occurs during the promotion, which will disconnect existing database connections.
After the switchover, the instance connection address and port remain unchanged. Ensure that your application has an automatic reconnection mechanism configured.

Prerequisites

Instance status: Running.

Directions

2. In the MongoDB drop-down list on the left sidebar, select Replica Set Instance or Shard Instance. The directions for the two types of instances are similar.
3. Above the Instance List on the right, select the region.
4. In the instance list, find the target instance.
5. Click the Instance ID to enter the Instance Details page and click the Node Management tab.
6. On the Mongod Node tab on the Node Management tab, find the target secondary node in the node list.
Replica set instance: In the node list, find the target secondary node and click Promote to Primary Node in the Operation column.

Sharded cluster instance: In the node list, find the target secondary node group and click Promote to Primary Node in the top-right corner.

7. In the Promote to Primary Node window, select Confirm the risk of the promotion to primary node and click OK.
8. Return to the Instance Details page, you can see that Instance Status is Promoting to Primary Node. After this status disappears, the task is completed. On the Node Management tab, you can see that the Role of the original secondary node becomes PRIMARY.

Related APIs

API
Feature Description
Adjusts the cloud database instance configurations
Queries the sales specifications of cloud databases

Ajuda e Suporte

Esta página foi útil?

comentários