Connecting to Replica Set via SSH tunnel fails but works from mongo cli

epicsteve shared this question 5 years ago

Hi All,

First of all, props to this great software.

I am using NoSQLBooster for a few months now. I have a replica set setup in AWS. I also have a bastion host machine which I am using as SSH tunnel to connect to that replica set. From bastion host, if I am using mongo CLI to connect to replica set, it works fine.

Any help is much appreciated. When I am using NoSQLBooster to connect to replica set through SSH tunnel, it fails with the following error:

17:24:38.279  *** Connect Error ***
{"errorLabels":["TransientTransactionError"],"message":"failed to connect to server [db-01:27018] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND db-01 db-01:27018]","name":"MongoNetworkError","stack":"MongoNetworkError: failed to connect to server [db-01:27018] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND db-01 db-01:27018]\n    at Pool.<anonymous> (C:\\Users\\xxxxxx\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\server.js:564:11)\n    at Pool.emit (events.js:182:13)\n    at Connection.<anonymous> (C:\\Users\\xxxxxx\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\pool.js:317:12)\n    at Object.onceWrapper (events.js:273:13)\n    at Connection.emit (events.js:182:13)\n    at Socket.<anonymous> (C:\\Users\\xxxxxx\\AppData\\Local\\Programs\\nosqlbooster4mongo\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connection.js:246:50)\n    at Object.onceWrapper (events.js:273:13)\n    at Socket.emit (events.js:182:13)\n    at emitErrorNT (internal/streams/destroy.js:82:8)\n    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)\n    at process._tickCallback (internal/process/next_tick.js:63:19)"} 

Replies (1)


It behaves exactly as MongoDB's server spec. We won't fix it. For details, please refer to our previous reply.

Although you can not connect to the entire replica set over SSH tunnel, you can still connect to one of the nodes to explore or manage your replica set. It is the same as you connect a stand-alone mongod server.

1. In the basic tab of Connection Editor. Set the Type as "Direct Connection", not "Replica Set | Shard Cluster".

2. Enter the server host and port, which is one of the nodes of your replica set.

Once connected to any node in the RS, you can discover the RS topology via rs.config() or db.isMaster(). You could then use this information to reconnect to the primary node.

For a more detailed answer, please refer to:

Leave a Comment
Attach a file