Lab: Connect to your Atlas Cluster

The guide is asking you to use the command line but this won’t work since mongo isn’t installed locally.

Please advise.

Hi @Ken_Mathieu_Beaudin !

at the end of the chapter there is an Interactive Developer Environment (IDE). This is bash shell with mongo and other bins already installed for you.

To run it locally head over to the installation chapter in the docs.

I am not able to connect to my cluster using IDE environment, can any one help me?

What issue you are facing
Please show us the screenshot or error details

Hi,i am not able to connect to mogodb using shell .
following the same procedure as informed.
the IDE show error.
attaching the screenshot .
connection string :mongo “mongodb+srv://sandbox.wr6ht.mongodb.net/” --username m001-student

1 Like

What error are you getting?
I don’t see any error in your snapshot.It shows test result failed
Did you run the command in correct area of IDE
Did you hit enter after typing/pasting the connect string?

I am not able to connect to Atlas cluster. I am getting following erros.
connecting to: mongodb://sandbox-shard-00-02.ftsyv.mongodb.net.:27017,sandbox-shard-00-00.ftsyv.mongodb.net.:27017,sandbox-shard-00-01.ftsyv.mongodb.net.:27017/%3Cdbname%3E?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-exfvdg-shard-0&ssl=true
2020-10-27T10:02:45.134+0000 I NETWORK [js] Starting new replica set monitor for atlas-exfvdg-shard-0/sandbox-shard-00-02.ftsyv.mongodb.net.:27017,sandbox-shard-00-00.ftsyv.mongodb.net.:27017,sandbox-shard-00-01.ftsyv.mongodb.net.:27017
2020-10-27T10:02:45.771+0000 I NETWORK [js] Successfully connected to sandbox-shard-00-01.ftsyv.mongodb.net.:27017 (1 connections now open to sandbox-shard-00-01.ftsyv.mongodb.net.:27017 with a 5 second timeout)
2020-10-27T10:02:45.771+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-00.ftsyv.mongodb.net.:27017 (1 connections now open to sandbox-shard-00-00.ftsyv.mongodb.net.:27017 with a 5 second timeout)
2020-10-27T10:02:45.959+0000 I NETWORK [js] changing hosts to atlas-exfvdg-shard-0/sandbox-shard-00-00.ftsyv.mongodb.net:27017,sandbox-shard-00-01.ftsyv.mongodb.net:27017,sandbox-shard-00-02.ftsyv.mongodb.net:27017 from atlas-exfvdg-shard-0/sandbox-shard-00-00.ftsyv.mongodb.net.:27017,sandbox-shard-00-01.ftsyv.mongodb.net.:27017,sandbox-shard-00-02.ftsyv.mongodb.net.:27017
2020-10-27T10:02:46.535+0000 I NETWORK [js] Successfully connected to sandbox-shard-00-01.ftsyv.mongodb.net:27017 (1 connections now open to sandbox-shard-00-01.ftsyv.mongodb.net:27017 with a 5 second timeout)
2020-10-27T10:02:46.538+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-00.ftsyv.mongodb.net:27017 (1 connections now open to sandbox-shard-00-00.ftsyv.mongodb.net:27017 with a 5 second timeout)
2020-10-27T10:02:47.363+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-02.ftsyv.mongodb.net:27017 (1 connections now open to sandbox-shard-00-02.ftsyv.mongodb.net:27017 with a 5 second timeout)
2020-10-27T10:02:47.728+0000 I NETWORK [js] Marking host sandbox-shard-00-01.ftsyv.mongodb.net:27017 as failed :: caused by :: Location40659: can’t connect to new replica set master [sandbox-shard-00-01.ftsyv.mongodb.net:27017], err: Location8000: bad auth : Authentication failed.
2020-10-27T10:02:48.104+0000 I NETWORK [js] Marking host sandbox-shard-00-02.ftsyv.mongodb.net:27017 as failed :: caused by :: SocketException: can’t authenticate against replica set node sandbox-shard-00-02.ftsyv.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [sandbox-shard-00-02.ftsyv.mongodb.net:27017] connection pool error: network error while attempting to run command ‘isMaster’ on host ‘sandbox-shard-00-02.ftsyv.mongodb.net:27017
2020-10-27T10:02:48.478+0000 I NETWORK [js] Marking host sandbox-shard-00-00.ftsyv.mongodb.net:27017 as failed :: caused by :: SocketException: can’t authenticate against replica set node sandbox-shard-00-00.ftsyv.mongodb.net:27017 :: caused by :: socket exception [CONNECT_ERROR] server [sandbox-shard-00-00.ftsyv.mongodb.net:27017] connection pool error: network error while attempting to run command ‘isMaster’ on host ‘sandbox-shard-00-00.ftsyv.mongodb.net:27017
2020-10-27T10:02:49.612+0000 I NETWORK [js] Marking host sandbox-shard-00-01.ftsyv.mongodb.net:27017 as failed :: caused by :: Location40659: can’t connect to new replica set master [sandbox-shard-00-01.ftsyv.mongodb.net:27017], err: Location8000: bad auth : Authentication failed.
2020-10-27T10:02:49.613+0000 E QUERY [js] Error: can’t authenticate against replica set node sandbox-shard-00-01.ftsyv.mongodb.net:27017 :: caused by :: can’t connect to new replica set master [sandbox-shard-00-01.ftsyv.mongodb.net:27017], err: Location8000: bad auth : Authentication failed. :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed

Hi follow the step to sucess the exercice :wink:

4 Likes

bad authentication means wrong combination of userid/pwd
What did you give as password?
May be some invalid character or space got introduced while pasting the password at the time of creating your sandbox cluster

Hi @Muzaffar_ali_53011,

Please share the information requested by @Ramachandra_37567 :point_down: if you are still facing any issue.

Hi
I am facing issue while connection to mongoshell.
Error which I facing,I pasted below. please let me know where I need to improve the command.

bash-4.4# mongo "mongodb+srv://sandbox.ofcuo.mongodb.net/
MongoDB shell version v4.0.5
Enter password:
connecting to: mongodb://sandbox-shard-00-02.ofcuo.mongodb.net.:27017,sandbox-shard-00-00.ofcuo.mongodb.net.:27017,sandbox-shard-00-01.ofcuo.mongodb.net.:27017/%3Cdbname%3E?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-2y4u8j-shard-0&ssl=true
2020-11-01T05:41:19.699+0000 I NETWORK [js] Starting new replica set monitor for atlas-2y4u8j-shard-0/sandbox-shard-00-02.ofcuo.mongodb.net.:27017,sandbox-shard-00-00.ofcuo.mongodb.net.:27017,sandbox-shard-00-01.ofcuo.mongodb.net.:27017
2020-11-01T05:41:19.865+0000 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:19.865+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row.
2020-11-01T05:41:20.406+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:20.406+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 2 checks in a row.
2020-11-01T05:41:20.947+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:20.947+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 3 checks in a row.
2020-11-01T05:41:21.489+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:21.489+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 4 checks in a row.
2020-11-01T05:41:22.031+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:22.031+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 5 checks in a row.
2020-11-01T05:41:22.572+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:22.572+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 6 checks in a row.
2020-11-01T05:41:23.112+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:23.112+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 7 checks in a row.
2020-11-01T05:41:23.653+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:23.653+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 8 checks in a row.
2020-11-01T05:41:24.195+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:24.195+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 9 checks in a row.
2020-11-01T05:41:24.737+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:24.737+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 10 checks in a row.
2020-11-01T05:41:25.277+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:25.278+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 11 checks in a row.
2020-11-01T05:41:25.819+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:26.359+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:26.900+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:27.448+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:27.989+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:28.530+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:29.071+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:29.612+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:30.153+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:30.696+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:30.696+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 21 checks in a row.
2020-11-01T05:41:31.238+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:31.778+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:32.319+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:32.860+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:33.400+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:33.941+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:34.481+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:41:34.482+0000 E QUERY [js] Error: connect failed to replica set atlas-2y4u8j-shard-0/sandbox-shard-00-02.ofcuo.mongodb.net.:27017,sandbox-shard-00-00.ofcuo.mongodb.net.:27017,sandbox-shard-00-01.ofcuo.mongodb.net.:27017 :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed
bash-4.4# mongo "mongodb+srv://sandbox.ofcuo.mongodb.net/
MongoDB shell version v4.0.5
Enter password:
connecting to: mongodb://sandbox-shard-00-02.ofcuo.mongodb.net.:27017,sandbox-shard-00-00.ofcuo.mongodb.net.:27017,sandbox-shard-00-01.ofcuo.mongodb.net.:27017/%3Cdbname%3E?authSource=admin&gssapiServiceName=mongodb&replicaSet=atlas-2y4u8j-shard-0&ssl=true
2020-11-01T05:43:40.571+0000 I NETWORK [js] Starting new replica set monitor for atlas-2y4u8j-shard-0/sandbox-shard-00-02.ofcuo.mongodb.net.:27017,sandbox-shard-00-00.ofcuo.mongodb.net.:27017,sandbox-shard-00-01.ofcuo.mongodb.net.:27017
2020-11-01T05:43:40.755+0000 W NETWORK [ReplicaSetMonitor-TaskExecutor] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:40.755+0000 I NETWORK [ReplicaSetMonitor-TaskExecutor] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 1 checks in a row.
2020-11-01T05:43:41.296+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:41.296+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 2 checks in a row.
2020-11-01T05:43:41.836+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:41.836+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 3 checks in a row.
2020-11-01T05:43:42.385+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:42.385+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 4 checks in a row.
2020-11-01T05:43:42.927+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:42.927+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 5 checks in a row.
2020-11-01T05:43:43.468+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:43.468+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 6 checks in a row.
2020-11-01T05:43:44.010+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:44.010+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 7 checks in a row.
2020-11-01T05:43:44.551+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:44.551+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 8 checks in a row.
2020-11-01T05:43:45.091+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:45.091+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 9 checks in a row.
2020-11-01T05:43:45.633+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:45.633+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 10 checks in a row.
2020-11-01T05:43:46.173+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:46.173+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 11 checks in a row.
2020-11-01T05:43:46.720+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:47.264+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:47.805+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:48.346+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:48.886+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:49.427+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:49.968+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:50.508+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:51.049+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:51.590+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:51.590+0000 I NETWORK [js] Cannot reach any nodes for set atlas-2y4u8j-shard-0. Please check network connectivity and the status of the set. This has happened for 21 checks in a row.
2020-11-01T05:43:52.131+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:52.671+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:53.212+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:53.753+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:54.293+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:54.834+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:55.375+0000 W NETWORK [js] Unable to reach primary for set atlas-2y4u8j-shard-0
2020-11-01T05:43:55.375+0000 E QUERY [js] Error: connect failed to replica set atlas-2y4u8j-shard-0/sandbox-shard-00-02.ofcuo.mongodb.net.:27017,sandbox-shard-00-00.ofcuo.mongodb.net.:27017,sandbox-shard-00-01.ofcuo.mongodb.net.:27017 :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed

Is your cluster up and running?
Please check status in Atlas.Any errors?

Most likely you forgot to whitelist your IP address.

Yess,Its up & running.
I didn’t see any wrong with configuration.

I added IP (My-Machine) in network access.
Its seem successfully added without any error.but while i trigger connection command trough console its throwing me error.

3 posts were split to a new topic: Not able to connect to cluster through IDE

Hi @jay_bhosale,

Can you try to whitelist all the IPs by selecting 0.0.0.0 option?

Please take a look at this post for more information.

~ Shubham

I can’t paste the command to terminal. the terminal is not responding. what should I do?

Please show us the screenshot
May be you pasted it in wrong area?

Press the + button.