Giter Club home page Giter Club logo

Comments (6)

noamross avatar noamross commented on May 27, 2024

I note I have the same problem when I run the same code on Mac: the tunneling command claims connection, but I get no connection to the MongoDB with a socket timeout message.

from ssh.

jeroen avatar jeroen commented on May 27, 2024

Do you get the same issue if you use my mongodb server? For example as described here: https://jeroen.github.io/mongolite/connecting-to-mongodb.html#ssh-tunnel

from ssh.

noamross avatar noamross commented on May 27, 2024

I can connect to the server via mongo() just fine, but I can't test the port forward without SSH credentials to dev.opencpu.org.

from ssh.

jeroen avatar jeroen commented on May 27, 2024

Right, I meant using your own ssh server, but that public mongo server.

from ssh.

noamross avatar noamross commented on May 27, 2024

I'm not sure if I'm doing this right

session <- ssh::ssh_connect("USER@MY_SERVER")
ssh::ssh_tunnel(session, port = 22087, target = "mongo.opencpu.org:43942")
/ Waiting for connetion on port 22087...

Then

> con <- mongo("mtcars", url = "mongodb://MY_SERVER:22087/jeroen_test")
Error: No suitable servers found (`serverSelectionTryOnce` set): [connection refused calling ismaster on 'MY_SERVER:22087']

I think the connection refused error means I'm doing something wrong here, rather than the timeout problem I saw above.

from ssh.

jeroen avatar jeroen commented on May 27, 2024

OK I see the problem now. To connect to an ssh tunnel, you need to connect to the machine where you started the tunnel, and not MY_SERVER. It is then tunneled from your R process hosting the ssh tunnel, through the ssh-server, to the target host.

So your first step is OK, but in the second step you need to connect to localhost:

con <- mongo("mtcars", url = "mongodb://readwrite:test@localhost:22087/jeroen_test")

from ssh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.