0

im trying to use the MongoDB Connector for BI on my cloud instance which runs on compose.io. This is the command im using:

./mongosqld --mongo-uri mongodb://%host%:%port% --mongo-username %myuser% --mongo-password %mypassword% --auth --mongo-authenticationSource=admin  --mongo-ssl

the connection is setup but i always receive this error message: [schemaDiscovery] unable to initialize schema: no servers available: server selection failed: context deadline exceeded

any idea?

Alem Filli
  • 73
  • 1
  • 1
  • 7
  • Verify that you can actually connect through something simple like the [`mongo` shell](https://docs.mongodb.com/manual/mongo/) from the instance first. There is a separate `mongodb-org-shell` package for most unix based distributions you can install without installing the whole database on the instance. The message is essentially telling you that the server cannot be contacted, so that is the first issue you need to diagnose. – Neil Lunn May 15 '18 at 02:03

2 Answers2

1

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

Robert Walters
  • 1,367
  • 14
  • 10
0

I recently ran into a similar issue although the error was slightly different. My error had the same unable to initialize schema but it was an authentication issue

unable to initialize schema: unable to authenticate conversation 0: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.

The answer to this is to make sure that your user is added to the admin collection as the authSource defaults to admin. Or you can change the place it looks for the user by adding this flag --mongo-authenticationSource and changing it to the db that has the user.

mongosqld --mongo-uri mongodb://%host%:%port% --mongo-username %myuser% --mongo-password %mypassword% --auth --mongo-authenticationSource=<SOMETHING OTHER THAN ADMIN HERE>  --mongo-ssl

--mongo-authenticationSource <auth-db-name>
bolnad
  • 4,533
  • 3
  • 29
  • 41