KeplerGrid guide

Troubleshoot MongoDB DNS and TLS connection errors

Start with Test connection to see where a MongoDB connection stopped. Correct the failed check, then test again before opening the workspace.

Read the reported connection check

Open File → New Connection…, enter your connection settings, and select Test connection. Read the check named in the result. The test uses a temporary connection. Select Connect after the corrected settings pass.

  • DNS points to a lookup problem. Verify the hostname and the resolver in use.
  • MongoDB connection can cover timeouts, refused connections, or failures across several hosts. Check that the server is running and reachable, which for Atlas may mean checking its IP access list.
  • TLS points to a handshake or certificate check. Confirm the server name and trusted certificate chain.
  • Authentication points to the login or access check. Use the authentication troubleshooting guide for credentials and the authentication database.

Look up the DNS seed list

For a mongodb+srv:// URI, copy the exact connection hostname from Atlas or your administrator. Omit credentials and URI options when checking DNS. In the commands below, replace cluster.example.invalid with that hostname. The example domain is a placeholder.

nslookup -type=SRV _mongodb._tcp.cluster.example.invalid
nslookup -type=TXT cluster.example.invalid

The SRV query should return server names and ports. The TXT query may return driver options. If SRV lookup fails, compare with the connection instructions for your deployment and check whether your VPN or DNS policy can resolve the records. For a standard mongodb:// URI, check the listed hosts and ports individually. When using SSH, database hostnames in a standard URI must be reachable from the SSH server.

Keep certificate checks enabled

Use the DNS name supplied by the deployment. The hostname the MongoDB driver connects to must match the certificate. With an SRV URI, this can be one of the hosts returned by DNS. An IP address or alias may reach the server and fail certificate verification.

Check the system clock and have the administrator verify the server’s certificate validity and complete certificate chain. For a private CA, ask which trusted CA your deployment uses and how to make it available to the client. Use the deployment’s TLS settings and keep both certificate and hostname validation enabled.

Run Test connection again. A new failure in a later check narrows down what still needs attention. With a replica set, verify that the member names advertised by MongoDB are also reachable and valid for TLS.

See Atlas connection setup or replica set connections over SSH.

Connect a MongoDB GUI to Docker Compose · Fix MongoDB ECONNREFUSED on localhost