Could not connect to MongoDB on the provided host and port

Hi @Shikha_66169,

Please share the screenshot showing the ping command and error. Remove http:// from the beginning of the host if it is there:

  ping cluster0-shard-00-00-jxeqq.mongodb.net

Kanika

@Sonali_Mamgain @Kanika

Attached are the screenshots .
I still face the issue in connecting to database. I am using windows 10 system, 64 bit . Hence tried to access link which works for me :

The link works for me: http://cluster0-shard-00-00-jxeqq.mongodb.net:27017/

cmd%20ping%20error compass_error link%20accessible

Even tried telnet command but it shows command not found .
telnet_error

Your ping itself failing.Could be network or firewall/port block issues
Are you trying from office or home?Please try from another location

Should see output as below
C:\Users\ramrt\M001>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=268ms TTL=34

Hi @Shikha_66169,

Please try running below command and share us the output. Please install Mongo if not already installed before running the command:

 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

And if you still facing trouble, as @Ramachandra_37567 suggested, it might be because of firewall issue. Please try from personal machine and let us know.

Kanika

Hi Kanika,

I have similar problem. When I ping it sent and received packets but running the above command results in the output below;
C:\Users\alagb>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.9
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-05-16T19:22:06.815-0600 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-05-16T19:22:07.328-0600 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:07.328-0600 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-05-16T19:22:08.373-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:08.374-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 2 checks in a row.
2019-05-16T19:22:09.276-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:09.277-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 3 checks in a row.
2019-05-16T19:22:10.203-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:10.203-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 4 checks in a row.
2019-05-16T19:22:11.115-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:11.115-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 5 checks in a row.
2019-05-16T19:22:12.013-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:12.013-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 6 checks in a row.
2019-05-16T19:22:12.946-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:12.946-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 7 checks in a row.
2019-05-16T19:22:13.831-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:13.831-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 8 checks in a row.
2019-05-16T19:22:14.735-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:14.736-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 9 checks in a row.
2019-05-16T19:22:15.644-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:15.644-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 10 checks in a row.
2019-05-16T19:22:16.553-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:16.554-0600 I NETWORK [js] Cannot reach any nodes for set Cluster0-shard-0. Please check network connectivity and the status of the set. This has happened for 11 checks in a row.
2019-05-16T19:22:17.530-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:18.437-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:19.345-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:20.251-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:21.161-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:22.063-0600 W NETWORK [js] Unable to reach primary for set Cluster0-shard-0
2019-05-16T19:22:22.064-0600 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

What can I do?
Solomon

In lecture mongo download was not specified . Can you please let me know steps for downloading mongo and anything else apart from compass .

Also as of now in command prompt your command giving error :

Hi @Shikha_66169,

Please follow all the Lectures and Labs according to the Chapter sequence. The steps to download Mongo and connection to Class Atlas Cluster from mongo shell will be discussed in Chapter 2.
I would recommend you to follow the flow of course for better understanding MongoDB Basics.

Thanks,
Sonali

Hi @Solomon_31460,

Please check your internet connection and then re-try connecting to the Class Atlas cluster.

Let me know, if you face any problem.

Thanks,
Sonali

Many thanks Sonali, The problem has been resolved.

Many thanks Shikha, the problem has been solved.

When I connect, I am not getting anything. No error. Just a thin green line near the top then it goes away. The results I am getting are not like in the video. I have tried to entering and re-entering (copy and paste) from the notes below the video. I have deleted the compass .exe that was downloaded and downloaded it again.

Please advise

Hi @Ronna_63887,

Please share the following details :

  • Version of the Compass that you have downloaded
  • Name and version of the operating system that you are using
  • Screenshot of the error that you are getting in Compass

Thanks,
Shubham Ranjan
Curriculum Support Engineer