This topic introduces the node failure handling mechanism of ApsaraDB for MongoDB instance.

Standalone instances

A standalone instance has only one node. If the node is faulty, the system troubleshoots to fix the fault. The node does not provide services while troubleshooting.
Note Standalone instances are suitable for test, training, and non-core business scenarios. If your application is in a production environment, we recommend that you use replica set or sharded cluster instances to ensure high availability (HA).

Replica set instances

Figure 1. Architecture
A replica set instance provides multiple nodes. If one of the nodes is faulty, the system switches over to the secondary node or hidden node without interruption and then troubleshoots to fix the fault. You can view this entire process, but there may be a brief disconnection of less than 30 seconds. We recommend that you configure your application to reconnect to the instance after it is disconnected.
Note If your application is in a production environment, we recommended that you do not use the connection string of the primary node but use a connection string URI to connect your application to a replica set instance. When you use the connection string URI, the read/write operations of your application remain available even if a node of the instance is faulty. For more information, see Overview of replica set instance connections.

Sharded cluster instances

Figure 2. Architecture
In a sharded cluster instance, the shards and config server both use three-node replica set architecture. When a node is faulty, the system switches over to the hidden node without interruption and then troubleshoots to fix the fault. You can view this entire process, but there may be a brief disconnection of less than 30 seconds. We recommend that you configure your application to reconnect to the instance after it is disconnected.
Note
  • A mongos has only one node. If its node is faulty, its services become unavailable.
  • If your application is in a production environment, we recommended that you do not use the connection string of a mongos but use a connection string URI to connect your application to a sharded cluster instance. When you use the connection string URI, your client automatically redirects requests to mongos in the normal state if the connected mongos is faulty. For more information, see Overview of sharded cluster instance connections.