Announcement

Collapse
No announcement yet.

Connection Problems With ATlas MongoDB Cloud Database

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [CONFIGURATION] Connection Problems With ATlas MongoDB Cloud Database

    Good afternoon Guys, I'm having a very strange problem here. I'm doing some MongoDB training and created a MongoDB Atlas Cluster on AWS through MongoDB site. The server is cluster0-shard-00-01.g1knc.mongodb.net, I can ping the server, I can access port 27107(where the server is), tested with curl and etc... but I can't connect to the server either through MongoDB shell or through MongoDB compass. Tried everything, I had a local MongoDB installed through Snap which was working fine. I removed the local server, changed my DNS configuration to google DNS servers, previously was pointed to Opendns, installed Oracle Java 11 Sdk and no success. There is no local server running now and problem persisted, so it was not any conflict with local Mongo installation. Now the curious thing, I have a dual boot with Windows 10. Everything is working fine on Windows. I can ping, use the ports and can connect very fast to the atlas Db with Mongo shell or Mongodb compass using the same string connection using the same lan, my home lan.

    I asked for Mongo support but as I can connect through WIndows in the same machine, network problems(port blocked, wi-fi, router, firewall and etc..) were discarded. The Mongo shell is a simple executable cli application and don't have any extra configuration. So, My Mongo friends just said that if I can connect through WIndows in the same machine, there seems to be a configuration problem on my linux which they can't help. I'm running Kubuntu 20.04 focal fossa and that's the first problem I have w/ Kubuntu in years. The error is the following :

    # mongo "mongodb+srv://cluster0.g1knc.mongodb.net/aula" --username <myusername which I know>
    MongoDB shell version v4.4.4
    Enter password: connecting to: mongodb://cluster0-shard-00-02.g1knc.mongodb.net:27017,cluster0-shard-00-01.g1knc.mongodb.net:27017,r>cluster0-shard-00-00.g1knc.mongodb.net:27017/aula?authSource=admin&amp;compressors=disabled&amp ;gssapiServiceName=mongodb&amp;replicaSet=atlas-26tdmh-shard-0&amp;ssl=true
    {"t":{"$date":"2021-04-13T20:37:53.510Z"},"s":"I", &nbsp;"c":"NETWORK", &nbsp;"id":4333208, "ctx":"ReplicaSetMonitor-TaskExecutor","msg":"RSM host selection timeout","attr":{"replicaSet":"atlas-26tdmh-shard-0","error":"FailedToSatisfyReadPreference: Could not find host matching read preference { mode: "nearest" } for set atlas-26tdmh-shard-0"}}

    *** You have failed to connect to a MongoDB Atlas cluster.

    Please ensure that your IP whitelist allows connections from your network.
    Error: connect failed to replica set atlas-26tdmh-shard-0/cluster0-shard-00-02.g1knc.mongodb.net:27017,cluster0-shard-00-01.g1knc.mongodb.net:27017,cluster0-shard-00-00.g1knc.mongodb.net:27017 :
    connect@src/mongo/shell/mongo.js:374:17
    @(connect):2:6
    exception: connect failed
    exiting with code 1

    # ping cluster0-shard-00-01.g1knc.mongodb.net
    PING ec2-34-233-245-125.compute-1.amazonaws.com (34.233.245.125) 56(84) bytes of data.
    64 bytes de ec2-34-233-245-125.compute-1.amazonaws.com (34.233.245.125): icmp_seq=1 ttl=30 tempo=181 ms
    64 bytes de ec2-34-233-245-125.compute-1.amazonaws.com (34.233.245.125): icmp_seq=2 ttl=30 tempo=183 ms
    64 bytes de ec2-34-233-245-125.compute-1.amazonaws.com (34.233.245.125): icmp_seq=3 ttl=30 tempo=182 ms
    64 bytes de ec2-34-233-245-125.compute-1.amazonaws.com (34.233.245.125): icmp_seq=4 ttl=30 tempo=183 ms

    //port 27017 test
    # curl portquiz.net:27017
    Port 27017 test successful!
    Your IP: 177.4.236.233

    # curl cluster0-shard-00-01.g1knc.mongodb.net:27017
    curl: (52) Empty reply from server // look that it replied on port !
    Any Ideas of what can be blocking this connection?

    Tks..
    Last edited by FabsMuller; Apr 13, 2021, 03:20 PM. Reason: remmoving html tags

    #2
    After many tests and trials I found out that it's something security related, If I use the --tls --tlsAllowInvalidCertificates options, I can connected. Allow invalid certificate is not a good security option according to Mongo team but as I'm connecting into their cloud cluster and as it's a test cluster, no big deal at this moment. I tried many options, generating certificates, tried to connect with some but no success without the options above. The bad thing here is that I can connect with Windows 10 without any further effort. I'm almost giving up Mongo not due to this issue but others that I find along the way, so there is no rush in solve this issue but I would like just to leave here as a problem that others may have. Thanks.

    Comment

    Working...
    X