Hi, I have installed the mongoDB compass. When i am trying to connect to the server, it is giving error “Could not connect to MongoDB on the provided host and port” though PORT is reachable.
Please help!
Please try running this command from the terminal / command line:
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/video?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
If you are able to connect from the above command, then view this post if it help you: About the Chapter 1: Compass Connection [Solution]
Kanika
What if one is unable to connect from the command line also?
My command line gives this:
"
2019-02-23T15:26:45.428+0100 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):1:6
exception: connect failed
"
Hi @Toyyib_52111,
Please share the command you are using to connect.
Also, check if your network is not blocking request.
- ping cluster0-shard-00-00-jxeqq.mongodb.net . If you are able to ping then try to see if you can reach the cluster via tracert
- tracert cluster0-shard-00-00-jxeqq.mongodb.net . If tracert shows that you can reach the server, then try telnet. On Mac, you can tracert using
Launch Network Utility -> Click on Traceroute -> Enter cluster0-shard-00-00-jxeqq.mongodb.net -> Click Trace. If it looks like this, means you can access the cluster.
- telnet cluster0-shard-00-00-jxeqq.mongodb.net 27017. If you are able to connect via telnet then check if there is no white spaces added to the fields.
~$ telnet cluster0-shard-00-00-jxeqq.mongodb.net 27017
Trying 34.195.121.130...
Connected to ec2-34-195-121-130.compute-1.amazonaws.com.
- Also, can you go to your browser and try http://cluster0-shard-00-00-jxeqq.mongodb.net:27017/ . The output should be:
It looks like you are trying to access MongoDB over HTTP on the native driver port.
If you get the above message, then that means you can access Atlas.
- Incase, your network is blocking the request, it would be advisable to work with your network admin to unblock the request or try from your home network.
Kanika
Seems like the network is unstable.
Can you please try running the mongo connection
command from another system or with good network?
Kanika
Thanks.
but my command prompt shows me that my shell and server versions are not same what does it mean
Hi @jalpa_46920,
You can safely ignore this warning message. Let me know if you are having any other issue.
Thanks,
Shubham Ranjan
Curriculum Services Engineer
thanks.
not at present.
Closing this thread as there are no unresolved issues and the thread is old.