MongoDB.live, free & fully virtual. June 9th - 10th. Register Now MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Unable to connect from 3.4.2 shell,but can from compass

Hello, I have created a 3 node Atlas cluster and am able to connect from my laptop using compass so i know its operational, however when connecting from a 3.4.2 command shell on linux i get errors that no primary is detected. The linux server and my laptop are whitelisted , but why do i get 2 different results ?

 /opt/mongodb/mongodb-linux-x86_64-3.4.2/bin/mongo "mongodb://tmx-mongolog-test-shard-00-00.tqcbm.mongodb.net:27017,tmx-mongolog-test-shard-00-01.tqcbm.mongodb.net:27017,tmx-mongolog-test-shard-00-02.tqcbm.mongodb.net:27017/test?replicaSet=atlas-o7jz9u-shard-0"  --authenticationDatabase admin  --username xxxxxxxxxx --password  yyyyyyyyyy
MongoDB shell version v3.4.2
connecting to: mongodb://tmx-mongolog-test-shard-00-00.tqcbm.mongodb.net:27017,tmx-mongolog-test-shard-00-01.tqcbm.mongodb.net:27017,tmx-mongolog-test-shard-00-02.tqcbm.mongodb.net:27017/test?replicaSet=atlas-o7jz9u-shard-0
2020-05-01T14:15:13.969-0500 I NETWORK  [thread1] Starting new replica set monitor for atlas-o7jz9u-shard-0/tmx-mongolog-test-shard-00-00.tqcbm.mongodb.net:27017,tmx-mongolog-test-shard-00-01.tqcbm.mongodb.net:27017,tmx-mongolog-test-shard-00-02.tqcbm.mongodb.net:27017
2020-05-01T14:15:14.126-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:14.126-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 1 checks in a row.
2020-05-01T14:15:14.790-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:14.790-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 2 checks in a row.
2020-05-01T14:15:15.461-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:15.461-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 3 checks in a row.
2020-05-01T14:15:16.129-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:16.129-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 4 checks in a row.
2020-05-01T14:15:16.803-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:16.803-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 5 checks in a row.
2020-05-01T14:15:17.476-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:17.476-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 6 checks in a row.
2020-05-01T14:15:18.147-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:18.147-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 7 checks in a row.
2020-05-01T14:15:18.809-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:18.809-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 8 checks in a row.
2020-05-01T14:15:19.478-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:19.479-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 9 checks in a row.
2020-05-01T14:15:20.147-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:20.147-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 10 checks in a row.
2020-05-01T14:15:20.816-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:20.816-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 11 checks in a row.
2020-05-01T14:15:21.480-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:22.151-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:22.819-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:23.487-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:24.156-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:24.823-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:25.485-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:26.154-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:26.817-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:27.487-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:27.487-0500 I NETWORK  [thread1] All nodes for set atlas-o7jz9u-shard-0 are down. This has happened for 21 checks in a row.
2020-05-01T14:15:28.154-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0
2020-05-01T14:15:28.823-0500 W NETWORK  [thread1] No primary detected for set atlas-o7jz9u-shard-0

Add the --ssl flag. You must have lost it in the copy/paste.

Why not use a more current shell version? Then you can use the mongodb+srv uri.

–ssl does not work from 3.4.2 - Error parsing command line: unrecognised option ‘–ssl’
I’m running several 3.4.2 instances - the point of doing this is to migrate from 3.4.2 on-prem to Atlas
Do I need to miograte each db from 3.4.2 to 3.6 before migrating to Atlas ? The documentation says we can migrate from 3.4.2 so that was my initial attempt

Hi Pierre,

This indicates you have a mongo shell without TLS/SSL support (which is required for connecting to Atlas). Based on your path of /opt/mongodb/mongodb-linux-x86_64-3.4.2/, I suspect you have installed the generic Linux tarball which does not include TLS/SSL (or any other external library dependencies).

What Linux distro & version are you using? If you can install a packaged version from MongoDB, it will include TLS/SSL support. See MongoDB Community Edition installation tutorials.

Regards,
Stennie

1 Like

Also to connect to a 3.6 cluster you need at least 3.6 shell. And it can just be mongo shell on your laptop for instance. No need to install a newer shell on your source server.

What are you attempting to do with the shell on the source server? That may yield some better advise.

Stennie, thanks for pointing out something i’ve been missing. I’m running on RHEL7 , wan’t aware of TLS/SSL requirements way back when this instance was created.
Regards,
Pierre

Hi Chris,

I’ve got an existing 3.4.2 instance running on Linux and we’re getting ready to move it to Atlas.I’ve been trying to connect from the command shell just to verify all the networking/firewall ports etc are working etc prior to using the Data Migration tool.

Regards
Pierre

One (hopefully final) followup question… do I need to upgrade to TSL/SSL support if all i’m going to do is use the Data Migration tool to move data up to Atlas ?
Thanks for all the tips…
Pierre

Hi Pierre,

TLS/SSL support on the source deployment is optional but recommended for security best practices.

The target Atlas cluster will have always have TLS/SSL enabled.

You only need local MongoDB tool versions with TLS/SSL support if you are trying to connect to your Atlas cluster from the command line.

Atlas also has a Data Explorer feature if you want to verify data has migrated without installing any additional local tools.

For more information, see Migrate or Import Data into Your Cluster.

Regards,
Stennie

2 Likes