Can't connect to mongo class atlas cluster using cmd

Getting a error%20in%20connection connection failed when trying to connect.

I am able to connect
Are you trying from office or home?
Please check if your ports are blocked
Are you able to ping the server

C:\Users\ramrt>ping cluster0-shard-00-00-jxeqq.mongodb.net

Pinging ec2-34-195-121-130.compute-1.amazonaws.com [34.195.121.130] with 32 bytes of data:
Reply from 34.195.121.130: bytes=32 time=265ms TTL=38
Reply from 34.195.121.130: bytes=32 time=264ms TTL=38

I’ve got similar problem; I could ping to C:\Users\ramrt>ping cluster0-shard-00-00-jxeqq.mongodb.net but it persisted…

Make sure your internet connectivity is good and please check this post: Compass Connection [Solution]

Let me know if does not work for you.

Kanika

Here is my problem.

C:\Users\npquang>mongo “mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
MongoDB shell version v4.0.8
connecting to: mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0
2019-04-10T17:17:34.518+0700 I NETWORK [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017
2019-04-10T17:17:50.982+0700 E NETWORK [ReplicaSetMonitor-TaskExecutor] SSL peer certificate validation failed: (800B0109)A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
2019-04-10T17:17:50.982+0700 E NETWORK [js] SSL peer certificate validation failed: (800B0109)A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
2019-04-10T17:17:50.985+0700 E NETWORK [ReplicaSetMonitor-TaskExecutor] SSL peer certificate validation failed: (800B0109)A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
2019-04-10T17:17:50.985+0700 E NETWORK [js] SSL peer certificate validation failed: (800B0109)A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
2019-04-10T17:17:51.918+0700 E NETWORK [ReplicaSetMonitor-TaskExecutor] SSL peer certificate validation failed: (800B0109)A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
2019-04-10T17:17:51.919+0700 E NETWORK [ReplicaSetMonitor-TaskExecutor] SSL peer certificate validation failed: (800B0109)A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
2019-04-10T17:17:51.919+0700 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-04-10T17:17:51.919+0700 I NETWORK [ReplicaSetMonitor-TaskExecutor] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row.
2019-04-10T17:17:51.920+0700 E QUERY [js] Error: connect failed to replica set Cluster0-shard-0/cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017 :
connect@src/mongo/shell/mongo.js:343:13
@(connect):2:6
exception: connect failed

C:\Users\npquang>ping cluster0-shard-00-00-jxeqq.mongodb.net

Pinging ec2-34-195-121-130.compute-1.amazonaws.com [34.195.121.130] with 32 bytes of data:
Reply from 34.195.121.130: bytes=32 time=236ms TTL=37
Reply from 34.195.121.130: bytes=32 time=239ms TTL=37
Reply from 34.195.121.130: bytes=32 time=235ms TTL=37
Reply from 34.195.121.130: bytes=32 time=236ms TTL=37

Ping statistics for 34.195.121.130:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 235ms, Maximum = 239ms, Average = 236ms

I can connect using Compass:

Do you have any idea to help me?

Thanks

Hi @Quang_54517,

This seems to be an SSL issue. Please take a look at this post: Can't connect to Atlas Class Cluster

Let me know if that helps.

Kanika

DNSHostNotFound: Failed to look up service “”:This operation returned because the timeout period expired.
try ‘mongo --help’ for more information

any help will be appreciated. On windows 7

MongoDB shell version v4.0.8

I discovered that the Server version on Sandbox is v3.6.11 meanwhile I installed mongoShell v4.0.8. Starting version 4.0, it use system-wide CA which seems not to be supported by Server 3.6.11.

I install version 3.4 and it works.

Hi Quang,

Do i need to uninstall mongoShell v4.0.8 and reinstall version 3.4?

Absolutely no.

You just need to install version 3.4 and it will come to your .\MongoDB\Server\3.4

Then you need to put this path into the $PATH as the first of order to access to the folder.

In my Windows 10, I put it on top of the System Environment Variables of Path.

Hi,

Installed shell v3.4.20 version, but issue still there.

C:\Users\Yeshwant Kumar Gupta>

C:\Users\Yeshwant Kumar Gupta>mongo --version

MongoDB shell version v3.4.20

git version: 447847d93d6e0a21b018d5df45528e815c7c13d8

OpenSSL version: OpenSSL 1.0.2o-fips 27 Mar 2018

allocator: tcmalloc

modules: enterprise

build environment:

distmod: windows-64

distarch: x86_64

target_arch: x86_64

C:\Users\Yeshwant Kumar Gupta>mongo “mongodb+srv://yeshkumargcluster-onqvz.mongodb.net/test” --username yeshkumarg

MongoDB shell version v3.4.20

connecting to: mongodb://mongodb%2Bsrv:/%2Fyeshkumargcluster-onqvz.mongodb.net%2Ftest

2019-04-11T16:57:41.167+0530 E QUERY [thread1] Error: No digits :

connect@src/mongo/shell/mongo.js:240:13

@(connect):1:6

exception: connect failed

C:\Users\Yeshwant Kumar Gupta>

It seems that you did not use the command line for the correct version of Mongo Shell.

Be aware to select the option: I have the Mongo Shell Installed then select the version 3.4 then you will see the command line would be different.

Please verify if you select the right version as in the attachmentUntitled

Good luck!
Quang

Hi

This issue is resolved. got solution from mongodb support team. And thanks to you, for help.

Thanks and Regards,

Yeshwant Gupta.

hey, would you mind sharing with me the solution?

I’ve been struggling with this for way too much time and haven’t found the solution.

What I’ve notices is that when I use “mongodb” on the connection uri it looks for the cluster, but it is not there, when I use “mongodb+srv” it throws the error. So the error is a DNS problem or something. I tryed turning off the firewall but doesn’t solve it

Hi Romulo,

The solution which works in my case is (Win 10):

  1. Install MongoDB shell version 3.4 instead of 4.0.8
  2. Set the path to version 3.4 in first place of $PATH
  3. Go to Sandbox server homepage which you have created
    3.1 Click CONNECT button then select Connect
    3.2 Chose Connect with Mongo Shell
    3.3 Select the option: I have the Mongo Shell installed (see the picture in my previous reply)
    3.4 Select the version 3.4 or earlier
    3.5 Copy the command line
  4. Use the command line in Mongo Shell

Good luck!
Quang

Hi Romulo_966 cl40

Please use below connecting string and replace primary cluster name and secondary cluster names accordingly.

mongo “mongodb://yeshkumargcluster-shard-00-00-onqvz.mongodb.net:27017,yeshkumargcluster-shard-00-01-onqvz.mongodb.net:27017,yeshkumargcluster-shard-00-02-onqvz.mongodb.net:27017/test?replicaSet=yeshKumarGCluster-shard-0” --ssl --authenticationDatabase admin --username urusername --password urpassword

Primary node : yeshkumargcluster-shard-00-01-onqvz.mongodb.net:27017

Secondary node1: yeshkumargcluster-shard-00-00-onqvz.mongodb.net:27017

Secondary node2: yeshkumargcluster-shard-00-02-onqvz.mongodb.net:27017

Thanks and Regards,

Yeshwant Gupta.