After the number of connections to an ApsaraDB for MongoDB instance reaches the limit, new connection requests cannot be responded. This topic describes how to handle database connection failures after the number of connections reaches the upper limit.
The maximum number of connections varies depending on ApsaraDB for MongoDB instance types. For more information, see Instance types.
- 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.
Check whether the number of connections has reached the upper limit
- Log on to the ApsaraDB for MongoDB console.
- In the upper-left corner of the page, select the resource group and the region of the target instance.
- In the left-side navigation pane, click Sharded Cluster Instances.
- Find the target instance and click its ID.
- In the left-side navigation pane, click Monitoring Data.
- On the Monitoring Data page, check the Connections information. The following figure shows that the number of connections to the instance
is 500. Note If the instance is a sharded cluster instance, you must select the Mongos node in use in the upper-right corner on the page.
- In the left-side navigation pane, click Basic Information.
- On the Basic Information page, query the maximum number of connections corresponding to the current instance
specifications. In this example, the number is 500.Note Based on the number of current connections, you can confirm that the number of connections has reached the upper limit.
- Configure the connection pool. For more information, see Limit the number of connections.
- Analyze the connection sources. For more information, see Query the source IP addresses of the current connections. If the service uses all the connections, upgrade the instance specifications. For more information, see Configuration change overview.