Unable to connect to Atlas Cluster via mongosql

I installed the mongo BI connector on my macbook laptop and getting the following error connecting to the cluster

____________________________LOG FILE_______________________________
2022-04-20T17:08:42.591-0400 I CONTROL    [initandlisten] mongosqld starting: version=v2.14.4 pid=4283 host=MLrbqy24J70MD6M
2022-04-20T17:08:42.591-0400 I CONTROL    [initandlisten] git version: df0cf0b57e9aac0ab6d545eee0d4451d11d0c6e9
2022-04-20T17:08:42.591-0400 I CONTROL    [initandlisten] OpenSSL version OpenSSL 1.1.1n  15 Mar 2022 (built with OpenSSL 1.1.1k  25 Mar 2021)
2022-04-20T17:08:42.591-0400 I CONTROL    [initandlisten] options: {config: "/usr/local/etc/mongosql.conf", systemLog: {logAppend: true, path: "/usr/local/var/log/mongodb/mongosql.log", verbosity: 1}, net: {bindIp: [127.0.1  192.168.0.248  0.0.0.0]}, security: {enabled: true}, mongodb: {net: {uri: "marty-dev-cluster.cqjnr.mongodb.net:27015", auth: {username: "marty_dev_user", password: "<protected>", source: "martyDev"}}}}
2022-04-20T17:08:42.599-0400 I NETWORK    [initandlisten] waiting for connections at 127.0.0.1:3307
2022-04-20T17:08:42.599-0400 I NETWORK    [initandlisten] waiting for connections at 192.168.0.248:3307
2022-04-20T17:08:42.599-0400 I NETWORK    [initandlisten] waiting for connections at [::]:3307
2022-04-20T17:08:42.599-0400 I NETWORK    [initandlisten] waiting for connections at /tmp/mysql.sock
2022-04-20T17:08:42.600-0400 I SCHEMA     [manager] attempting to initialize schema
2022-04-20T17:08:42.600-0400 I SCHEMA     [manager] sampling schema
2022-04-20T17:08:47.601-0400 E NETWORK    [initandlisten] unable to load MongoDB information: failed to create admin session for loading server cluster information: unable to execute command: server selection error: context deadline exceeded, current topology: { Type: Unknown, Servers: [{ Addr: marty-dev-cluster.cqjnr.mongodb.net:27015, Type: Unknown, Average RTT: 0, Last error: connection() error occured during connection handshake: dial tcp: lookup marty-dev-cluster.cqjnr.mongodb.net: no such host }, ] }
2022-04-20T17:08:47.601-0400 W SCHEMA     [manager] error initializing schema: unable to execute command: server selection error: context deadline exceeded, current topology: { Type: Unknown, Servers: [{ Addr: marty-dev-cluster.cqjnr.mongodb.net:27015, Type: Unknown, Average RTT: 0, Last error: connection() error occured during connection handshake: dial tcp: lookup marty-dev-cluster.cqjnr.mongodb.net: no such host }, ] }

Also I tried creating a schema with the following command

mongodrdl --host marty-dev-cluster.cqjnr.mongodb.net:27017 --username xxxxxx --password yyyyy–db martyDev --out martySchema.drdl

_________________________________OUTPUT____________________________________

Failed: unable to execute command: server selection error: context deadline exceeded, current topology: { Type: Single, Servers: [{ Addr: marty-dev-cluster.cqjnr.mongodb.net:27017, Type: Unknown, Average RTT: 0, Last error: connection() error occured during connection handshake: dial tcp: lookup marty-dev-cluster.cqjnr.mongodb.net: no such host }, ] }
1 Like

It says no such host
Is your URI correct?
Can you connect by shell or other tool like Compass?

Hi @Ramachandra_Tummala
The URI correct. I can connect to the database when I use mongosh

mongosh “mongodb+srv://marty-dev-cluster.cqjnr.mongodb.net/martyDev” --username yyyy --password xxxxx

The name marty-dev-cluster.cqjnr.mongodb.net is the name of a cluster, not the name of an host. For this reason you cannot use the –host argument for mongosqld. Instead you have to use –mongo-uri.

1 Like

Thanks @stevej.

For my BI connector mongosql I am using a config file see beelow
net:
  bindIp: "127.0.1" #, 192.168.0.248, 0.0.0.0"
  port: 3307
  ssl:
    mode: "disabled"

mongodb:
  # versionCompatibility: <string>
  net:
    uri: "marty-dev-cluster.cqjnr.mongodb.net:27015"
    ssl:
      enabled: false
    auth:
      username: "yyyy
      password: "xxxxx"
      source: "martyDev" # This is the name of the database to authenticate against.
      #mechanism: SCRAM-SHA-1

security:
  enabled: true

systemLog:
  #destination: file
  path: /usr/local/var/log/mongodb/mongosql.log
  logAppend: true
  quiet: false
  verbosity: 2
  logRotate: "rename" # "rename"|"reopen"

The title mislead me. For it, I assume it was mongodsql which was not able to connect. For mongodrdl you should use –uri rather than –host.

1 Like

@steevej
Sorry for the confusion
I am having a problem connecting to my Atlas cluster with both mongoaql and mongodrdl

I’ve tried the suggestions I’ve read but still getting the error in my log file

See the mongosql.config  contents in an previous reply

It’s not accepting my URI. It’s saying "no such host

Here is my log file:

2022-04-21T16:17:02.165-0400 W SCHEMA     [manager] error initializing schema: unable to execute command: server selection error: context deadline exceeded, current topology: { Type: Unknown, Servers: [{ Addr: marty-dev-cluster.cqjnr.mongodb.net:27015, Type: Unknown, Average RTT: 0, Last error: connection() error occured during connection handshake: dial tcp: lookup marty-dev-cluster.cqjnr.mongodb.net: no such host }, ] }

The host should be a resolvable name

For mongodrdl try this

To connect to a replica set, specify the replSetName and a seed list of set members, as in the following:

/<:port>,<:port>,<…>

Rather than

try
uri : "mongodb+srv://marty-...."

I do not think you should specify the port number. And 27015 is most likely wrong anyway.

Another thing is that

stops you from starting mongosqld because 127.0.1 is not a valid IP address.

1 Like

Hey @steevej
I looks like the issue is with my marty cluster. I can connect to a different Atlas cluster
Thanks for responding to my call for help!!

2 Likes