Cannot connect to MongoDB Atlas replica set via SSH tunnel
Solved
I have an issue to connect with MongoDB Atlas replica set via SSH tunnel.
My mongobooster version is v3.5.6 free edition and MongoDB is v3.4.4
You may apply a free account in MongoDB Atlas to reproduce.
Here is the error message:
{ "message" : "no primary found in replicaset", "stack" : "MongoError: no primary found in replicaset" + "at C:\\Users\\my_user\\AppData\\Local\\mongobooster\\app-3.5.6\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\replset.js:555:28" + "at Server.<anonymous> (C:\\Users\\my_user\\AppData\\Local\\mongobooster\\app-3.5.6\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\replset.js:312:24)" + "at Object.onceWrapper (events.js:290:19)" + "at emitOne (events.js:96:13)" + "at Server.emit (events.js:188:7)" + "at C:\\Users\\my_user\\AppData\\Local\\mongobooster\\app-3.5.6\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\server.js:299:14" + "at C:\\Users\\my_user\\AppData\\Local\\mongobooster\\app-3.5.6\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\pool.js:469:18" + "at _combinedTickCallback (internal/process/next_tick.js:67:7)" + "at process._tickCallback (internal/process/next_tick.js:98:9)", "name" : "MongoError" }
It works well in my test with a free account .Please see the attached picture.
Could you please give an accessible(mongo shell) test MongoDB URI to recall the issue?
It works well in my test with a free account .Please see the attached picture.
Could you please give an accessible(mongo shell) test MongoDB URI to recall the issue?
Resolved in 3.5.7
Resolved in 3.5.7
Hello!
I had the same problem (Cannot connect to MongoDB replica set via SSH tunnel) and it reproduces in 3.5.7.
case 1 (seems like dns problem, names do not resolve behind ssh):
```
{
"message" : "failed to connect to server [mongo3:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo3 mongo3:27017]",
"stack" : "MongoError: failed to connect to server [mongo3:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo3 mongo3:27017]" +
"at Pool. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\server.js:328:35)" +
"at emitOne (events.js:96:13)" +
"at Pool.emit (events.js:188:7)" +
"at Connection. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\pool.js:280:12)" +
"at Object.onceWrapper (events.js:290:19)" +
"at emitTwo (events.js:106:13)" +
"at Connection.emit (events.js:191:7)" +
"at Socket. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connection.js:177:49)" +
"at Object.onceWrapper (events.js:290:19)" +
"at emitOne (events.js:96:13)" +
"at Socket.emit (events.js:188:7)" +
"at connectErrorNT (net.js:1025:8)" +
"at _combinedTickCallback (internal/process/next_tick.js:74:11)" +
"at process._tickCallback (internal/process/next_tick.js:98:9)",
"name" : "MongoError"
}
```
ok, place mongo1,mongo2,mongo3 to hosts with IPs behind ssh:
```
{
"message" : "failed to connect to server [mongo3:27017] on first connect [MongoError: connect ETIMEDOUT 10.0.1.4:27017]",
"stack" : "MongoError: failed to connect to server [mongo3:27017] on first connect [MongoError: connect ETIMEDOUT 10.0.1.4:27017]" +
"at Pool. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\server.js:328:35)" +
"at emitOne (events.js:96:13)" +
"at Pool.emit (events.js:188:7)" +
"at Connection. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\pool.js:280:12)" +
"at Object.onceWrapper (events.js:290:19)" +
"at emitTwo (events.js:106:13)" +
"at Connection.emit (events.js:191:7)" +
"at Socket. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connection.js:177:49)" +
"at Object.onceWrapper (events.js:290:19)" +
"at emitOne (events.js:96:13)" +
"at Socket.emit (events.js:188:7)" +
"at emitErrorNT (net.js:1281:8)" +
"at _combinedTickCallback (internal/process/next_tick.js:74:11)" +
"at process._tickCallback (internal/process/next_tick.js:98:9)",
"name" : "MongoError"
}
```
Hello!
I had the same problem (Cannot connect to MongoDB replica set via SSH tunnel) and it reproduces in 3.5.7.
case 1 (seems like dns problem, names do not resolve behind ssh):
```
{
"message" : "failed to connect to server [mongo3:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo3 mongo3:27017]",
"stack" : "MongoError: failed to connect to server [mongo3:27017] on first connect [MongoError: getaddrinfo ENOTFOUND mongo3 mongo3:27017]" +
"at Pool. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\server.js:328:35)" +
"at emitOne (events.js:96:13)" +
"at Pool.emit (events.js:188:7)" +
"at Connection. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\pool.js:280:12)" +
"at Object.onceWrapper (events.js:290:19)" +
"at emitTwo (events.js:106:13)" +
"at Connection.emit (events.js:191:7)" +
"at Socket. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connection.js:177:49)" +
"at Object.onceWrapper (events.js:290:19)" +
"at emitOne (events.js:96:13)" +
"at Socket.emit (events.js:188:7)" +
"at connectErrorNT (net.js:1025:8)" +
"at _combinedTickCallback (internal/process/next_tick.js:74:11)" +
"at process._tickCallback (internal/process/next_tick.js:98:9)",
"name" : "MongoError"
}
```
ok, place mongo1,mongo2,mongo3 to hosts with IPs behind ssh:
```
{
"message" : "failed to connect to server [mongo3:27017] on first connect [MongoError: connect ETIMEDOUT 10.0.1.4:27017]",
"stack" : "MongoError: failed to connect to server [mongo3:27017] on first connect [MongoError: connect ETIMEDOUT 10.0.1.4:27017]" +
"at Pool. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\topologies\\server.js:328:35)" +
"at emitOne (events.js:96:13)" +
"at Pool.emit (events.js:188:7)" +
"at Connection. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\pool.js:280:12)" +
"at Object.onceWrapper (events.js:290:19)" +
"at emitTwo (events.js:106:13)" +
"at Connection.emit (events.js:191:7)" +
"at Socket. (C:\\Users\\Dalamar81\\AppData\\Local\\mongobooster\\app-3.5.7\\resources\\app.asar\\node_modules\\mongodb-core\\lib\\connection\\connection.js:177:49)" +
"at Object.onceWrapper (events.js:290:19)" +
"at emitOne (events.js:96:13)" +
"at Socket.emit (events.js:188:7)" +
"at emitErrorNT (net.js:1281:8)" +
"at _combinedTickCallback (internal/process/next_tick.js:74:11)" +
"at process._tickCallback (internal/process/next_tick.js:98:9)",
"name" : "MongoError"
}
```
Replies have been locked on this page!