This topic helps you resolve common connection issues with ApsaraDB for MongoDB instances. We recommend checking the Common errors section first for a quick solution. If your error isn't listed, follow the Troubleshooting steps for a systematic diagnosis.
Troubleshooting steps
Step 1: Check network connectivity
Troubleshooting method
Use the following commands to test network connectivity.
-
ping <domain name>, for example,ping dds-xxxx.mongodb.rds.aliyuncs.com
The figure shows a successful network connection between the client and the MongoDB instance.
-
telnet <domain name> <port number>, for example,telnet dds-xxxx.mongodb.rds.aliyuncs.com 3717
The figure shows that the domain name is resolved and that communication is possible over port 3717.
Checklist
If the network test fails, use the following checklist to identify and resolve the issue.
Step 2: Authorization and identity verification
Step 3: Check for other issues
Common errors
|
Error message |
Cause and solution |
|
|
|
|
The instance may have reached its maximum connection limit and cannot establish new connections. Solution:
|
|
|
The wait queue of the MongoDB driver is full. This can happen if the connection pool size is too small or if there are high-concurrency requests, resulting in no available connections. Solution:
|
|
|
Excessive concurrent connections may exhaust available sessions. Solution:
|
|
Check if the instance endpoint is correct. For more information about endpoints, see: |
|
This error occurs when an ECS instance fails to connect to an ApsaraDB for MongoDB instance over a private network. Solution:
|
|
|
|
|
This error occurs when a write operation is attempted on a node that is not the primary node. Cause: Write operations can be performed only on the primary node. If your service previously connected using the endpoint of the primary node, the connected node becomes a secondary node after a primary-secondary switchover. As a result, write operations fail. Solution:
Design a reconnection mechanism and exception handling for your application. This ensures that your application can automatically reconnect after a transient disconnection and remain stable. |
|
|
The instance is locked because the disk space is exhausted. Solution: Resolve instance locking or write failures caused by exhausted disk space. |
|
|
|
|
The password of the database account contains special characters such as |
|
|
ApsaraDB for MongoDB does not support the |