Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

544
Views
Connect to mongodb via ssh tunnel failing

I have tried to connect to my mongodb on a server i own via an ssh tunnel via the following apps but nothing will connect:

  • compass
  • robomongo
  • nosqlbooster4mongo
  • phpstorm inbuilt mongodb java connector

Server and mongo:

  • Server: ubuntu 18lts
  • Mongo: latest community version

The Connection URL in all instances is the same (also tried removing the query params) and this url works on the node app:

mongodb://localhost:27017/data-aggregator?retryWrites=true&w=majority

nosqlbooster4mongo's error message is: enter image description here But the connection url is 27017 and gets changed to 37903 for some reason enter image description here

PHPStorm's error message is:

DBMS: Mongo DB Case sensitivity: plain=mixed, delimited=mixed Driver: MongoDB JDBC Driver (ver. 1.13, JDBC4.2) Effective version: UNKNOWN (ver. 0.0) Ping: 10 sec, 289 ms (keep-alive query results in error)

Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:42865, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Exception receiving message}, caused by {java.net.SocketException: Connection reset}}].

Nothing works but i cannot understand why.

The SSH connection is working as confirmed by nosqlbooster4mongo and phpstorm

But as soon as it then tries to connect to the local mongodb instance it fails. I don't know if this is an issue with the SSH tunnel or the mongo setup. Via a terminal i can connect to mongo no issue, also the node app there can too.

The tunnels are using the same key as i use to connect to the server via terminal without issue which leads me to believe it is mongo but i don't know where to look :/

As the tunnel is established, then this says the server firewalls are not an issue.

I don't know what it is, is there an additional query param for ssh tunnel access?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Solved by @Jack_Woehr on: https://www.mongodb.com/community/forums/t/mongo-5-community-edition-cannot-connect-via-tunnel/151526

The trick was to not use the ssh tunnel from any of the tools listed and just create a the tunnel on the OS.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!