Help Center/ Document Database Service/ Troubleshooting/ DDS Instance Node Fault Handling Mechanism
Updated on 2023-06-14 GMT+08:00

DDS Instance Node Fault Handling Mechanism

Cluster Instance

The shard and config nodes of the cluster instance use the three-node replica set architecture. When a node is faulty, the system uses another normal node to replace the faulty node to continue providing services. In addition, the system checks and rectifies the faulty node. This process is transparent to users and may cause intermittent disconnection within 30 seconds. You are advised to enable automatic reconnection on your application.

Figure 1 Cluster instance diagram

The mongos node of a cluster instance uses the single-node architecture. When a mongos node is faulty, services on the node become unavailable. You are advised to use Connection String URI to connect to all mongos nodes instead of a single mongos node. If a mongos node becomes faulty, the client can automatically perform failover and distribute requests to normal mongos nodes. Command example:

mongo "mongodb://rwuser:xxxxxxxx@192.168.95.167:8635,192.168.92.43:8635/test?authSource=admin"

If you use Connection String URI to connect to a cluster instance that is compatible with MongoDB 3.4, you are advised to use a MongoDB client later than 4.0. Otherwise, an error is reported.

Figure 2 Error message

Replica Set Instance

Figure 3 Replica set instance diagram

A replica set instance consists of two nodes. When a node is faulty, the system uses the other node to continue providing services. In addition, the system checks and rectifies the faulty node. This process is transparent to users and may cause intermittent disconnection within 30 seconds. You are advised to enable automatic reconnection on your application.

You are advised to use Connection String URI to connect to the nodes. Do not directly connect to the primary node of a replica set instance. If Connection String URI is used and a node becomes faulty, the read and write operations will not be affected by the failover. Command example:

mongo "mongodb://rwuser:xxxxxxxx@192.168.168.116:8635,192.168.200.147:8635/test?authSource=admin&replicaSet=replica"

For best practices of connecting replica set instances, see Connecting to a Replica Set Instance for Read and Write Separation and High Availability.

Single-Node Instance

Figure 4 Single-node instance diagram

As the name implies, single-node instance provides only one node for users to access. When a node is faulty, the system checks and rebuilds the faulty node. In the meanwhile, services on the node become unavailable.

Single-node instances apply to scenarios such as testing, training, and non-core services. You are advised to use cluster instances or replica set instances in the production environment to ensure high service availability.