When the number of connections to an apsaradb for MongoDB instance reaches the upper limit, new connection requests cannot be responded. The following scenarios describe the failures:
Instructions the maximum number of connections varies depending on apsaradb for MongoDB instance types. For more information, see instance specifications.
- The application fails to connect to the database.
- The whitelist has been properly set. However, the following error message is displayed when you use the Mongo Shell to connect to the database.
2019-07-10T10:30:43.597+0800 E QUERY [js] Error: network error while attempting to run command 'isMaster' on host 'dds-bpxxxxxxxx.mongodb.rds.aliyuncs.com:3717' : connect@src/mongo/shell/mongo.js:328:13 @(connect):1:6 exception: connect failed
- The whitelist has been properly set. However, the following error message is displayed when you use DMS to connect to the database.
The connection between DMS and the apsaradb for MongoDB server cannot be established. Check whether the connection address is correct, whether the network is running properly, and whether the whitelist is configured properly.
The error message returned because the number of connections to the apsaradb for MongoDB instance is not reached.
Alibaba Cloud reminds you that:
- Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
- You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
- If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.
Check whether the number of MongoDB connections has been exhausted.
- Login apsaradb for MongoDB console.
- In the upper-left corner of the page, select the resource group and region where the instance is located.
- In the left-side navigation pane, choose sharded cluster instances.
- Find the original RDS instance and click its ID.
- In the left-side navigation pane, choose monitoring information.
- In monitoring information page, view the current connections information. Make sure that the instance has too many connections.
Instructions to obtain the required monitoring information faster, we recommend that you set the monitoring granularity of the MongoDB instance to seconds. For more information, see set the monitoring granularity.
- In the left-side navigation pane, choose basic information.
- In basic information page, find connection information area, click view more connections, you can determine whether the number of connections to the instance has reached the limit based on the number of connections established in step 6.
Instructions if you restart the instance, all nodes of the instance are restarted one by one. Each node has a transient disconnection of about 30 seconds. If the instance has a large number of collections (more than 10,000), the transient disconnections last longer. Before restarting the instance, arrange your business and ensure that your application has a reconnection mechanism.
- Configure the connection pool. For more information, see how to limit the number of connections to a terminal.
- Analyze the source of the connection. For more information, see analyze the source of the connection. According to analysis, if the service uses all connections, upgrade the specifications of the instance. For more information, see configuration change Overview.
- ApsaraDB for MongoDB