Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/

like image 266
Michel Pureza Avatar asked Jan 02 '23 22:01

Michel Pureza


2 Answers

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.

like image 99
Robert Walters Avatar answered Jan 05 '23 12:01

Robert Walters


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.

like image 26
deafgoat Avatar answered Jan 05 '23 11:01

deafgoat