Why Does HA Trigger a Switchover?
In What Situation Will Switchover Be Triggered?
DDS supports two types of HA architectures: sharded cluster (sharding) and replica set
- A cluster consists of three types of nodes: mongos, shard, and config. shard and config use the three-node replica-set architecture. When a primary node becomes faulty, a switchover is performed.
- The replica-set architecture consists of three nodes: primary, secondary, and hidden. The primary and secondary nodes provide IP addresses for external access. The primary node of a replica set instance is not fixed. When the configuration of the replica set instance changes, or the primary node breaks down, or a switchover is performed, the replica set will elect a node as primary, and the original primary node is demoted to the secondary.
For more information, see Cluster Architecture and Replica Set Architecture.
Impact of a Switchover
When the primary node becomes faulty, the system selects the secondary node as the new primary within 30 seconds.
If your application connects to the DB instance through the IP address of the primary node, a switchover may cause connection failure, affecting the read and write operations.
Service Deployment Suggestion
Ensure that your application supports automatic reconnection. It means that the application can be automatically reconnected to the DB instance to avoid writing errors when intermittent disconnects occur.
It is recommended that you use URLs to connect the cluster and replica set instances. When a node is faulty, the primary/standby switchover does not affect service read and write operations. For details, see Connecting to a Cluster Instance and Connecting to a Replica Set Instance for Read and Write Separation and High Availability.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.