This topic helps you troubleshoot issues when connecting to an ApsaraDB for MongoDB instance. We recommend that you first check the Common errors section to quickly identify and resolve the issue. If you cannot find a matching error message, follow the Troubleshooting steps to diagnose and resolve the connection issue.
Troubleshooting steps
Step 1: Check network connectivity
Troubleshooting method
Use the following commands to test connectivity to the ApsaraDB for MongoDB instance.
-
Run the
ping <domain>command. For example, runping dds-xxxx.mongodb.rds.aliyuncs.com.ping dds-xxx.mongodb.rds.aliyuncs.com PING dds-xxx.mongodb.rds.aliyuncs.com (xxx): 56 data bytes 64 bytes from xxx: icmp_seq=0 ttl=90 time=7.698 ms 64 bytes from xxx: icmp_seq=1 ttl=90 time=7.085 ms 64 bytes from xxx: icmp_seq=2 ttl=90 time=11.006 ms 64 bytes from xxx: icmp_seq=3 ttl=90 time=12.154 ms 64 bytes from xxx: icmp_seq=4 ttl=90 time=9.149 msThe sample output indicates that the client can connect to the ApsaraDB for MongoDB instance.
-
Run the
telnet <domain> <port>command. For example, runtelnet dds-xxxx.mongodb.rds.aliyuncs.com 3717.root@mongotest:~# telnet xxx.mongodb.rds.aliyuncs.com 3717 Trying xxx... Connected to xxx.mongodb.rds.aliyuncs.com. Escape character is '^]'.The sample output indicates that the domain name is resolved correctly and that port 3717 is accessible.
Checklist
If the network test fails, use the following checklist to identify and resolve the issue.
Step 2: Authorization and authentication
Step 3: Other checks
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, which leaves no connections available. Solution:
|
|
|
Excessive concurrent connections can exhaust available sessions. Solution:
|
|
Check whether the instance endpoint is correct. For more information about endpoints, see the following topics: |
|
An ECS instance fails to connect to an ApsaraDB for MongoDB instance over a private network. Solution:
|
|
|
|
|
The node to which data is being written is not a primary node. Cause: Write operations can be performed only on the primary node. If your application was previously connected by using the endpoint of the primary node, a failover can change the connected node to a secondary node, which causes write operations to fail. Solution:
We recommend that you implement a reconnection mechanism and exception handling in your application. This ensures that the application can automatically reconnect after a transient disconnection and maintain stability. |
|
|
Exhausted disk space has locked the instance. 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 |