Mongo 5 community edition cannot connect via tunnel

I landed on this post which talks about an inability to connect:

I hit a very similar sounding issue but appear to have narrowed it down to the mongo database connection, ruling out the ssh tunnel.

I posted a question on SO:

Is there something else that is required, maybe an additional connection query param, to connect to a mongo instance over shh tunnel?

Here is the mongo version output:

 mongo --version
MongoDB shell version v5.0.6
Build Info: {
    "version": "5.0.6",
    "gitVersion": "212a8dbb47f07427dae194a9c75baec1d81d9259",
    "openSSLVersion": "OpenSSL 1.1.1  11 Sep 2018",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu1804",
        "distarch": "x86_64",
        "target_arch": "x86_64"

One possibility is, “Don’t use Compass’s ssh facility, do it yourself.” See my responses in this discussion: Connect Compass with remote database via two ssh tunnels … of course, you’d only need one tunnel for what you’re describing.

1 Like

@Jack_Woehr thank you!

ssh -4 -L 27017:localhost:27017 myserversshconfigname

Works perfectly! Thanks for the tip.

NB for anyone else finding this, I hit an issue with ipv6 hence the -4 flag to force ipv4. I don’t know if this has been the issue all along, I will find that one out for another day.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.