'Failed: can't create session: no servers available: server selection failed: context deadline exceeded

I'm getting an error while trying to use the mongodb for bi connector. I am in the generation stage of the schema of difinição of the file utliznaod the executable mongodrdl. At the moment I'm getting the error below.

I've already made sure that the connection data to my base mongo is correct and I can access my base with other connection tools.

If someone has already had this problem, I would be grateful if they share the solution to the problem.

cmd command executed: "C:\Arquivos de Programas\MongoDB\Connector for BI\2.3\bin\mongodrdl.exe" --host {localhost} --db store --collection avalaible --out schema.drdl

cmd command executed: "C:\Arquivos de Programas\MongoDB\Connector for BI\2.3\bin\mongodrdl.exe" --host {127.0.0.1} --db store --collection avalaible --out schema.drdl

error: Failed: can't create session: no servers available: server selection failed: context deadline exceeded

installation tutorial I'm following: https://docs.mongodb.com/bi-connector/master/tutorial/install-bi-connector/



Solution 1:[1]

If you run into this issue with mongosqld itself try adding "/?connect=direct" to the URI, i.e. "mongosqld --mongo-uri "mongodb://192.168.0.28/?connect=direct". I have a replica set of 1 and ran into that error.

Solution 2:[2]

Michel, that error is a typical indication that you either don't have mongod running, or if you do, mongodrdl is unable to reach it. Check that you indeed have mongod running and reachable from the machine where you're running mongodrdl.

Also note that mongodrdl isn't required to use the BI Connector - there is a feature called 'sampling' that removes the need to first run mongodrdl. See https://docs.mongodb.com/bi-connector/master/schema-configuration/#cached-sampling for more.

Solution 3:[3]

In my case similar thing has happened when I'm trying to connect to mongoDB Atlas cluster via mongodrdl command provided by mongo documentation : https://docs.mongodb.com/bi-connector/master/reference/mongodrdl/ .

So make sure you give -ssl in the command if your cluster has ssl enabled otherwise you'll run into same issue. If you don't get any error in console then you should probably got connected.

Solution 4:[4]

it's quite weird for the error message . on my case, it was cause by a wrong username & password for specific database.

Solution 5:[5]

I had to wrap my password in quotations.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert Walters
Solution 2 deafgoat
Solution 3 whoami - fakeFaceTrueSoul
Solution 4 no7dw
Solution 5 faldeland