4

I'm playing with MongoDB. I have a good deal of experience with MySQL and was using something called Sequel Pro to connect to remote databases. I'm now trying MongoHub but can't seem to get it to connect to the remote database.

I tried a basic SSH tunnel

ssh -f user@remotehost.com -L 9009:remotehost.com:27017 -N

But this didn't work. How do other DB management tools use a ssh login to provide a connection to the database that doesn't have an open port? Is this something I could setup by myself (via a tunnel or something else)?

Josh K
  • 454
  • 1
  • 6
  • 18
  • To talk to anything past a firewall you need an open port, what do you mean by something that doesn't have an open port? – jer.salamon Jun 23 '10 at 16:55
  • What connection string are you using to connect to the database? Can you connect to it with the command line mongo client? Can you telnet to localhost 9009? – Justin Dearing Sep 01 '10 at 18:09

1 Answers1

5

Here's what I do to get to my remotely mysql server (I've got mysql restricted to localhost only):

ssh -fNL 9999:localhost:3306 myuser@myremotemachine

To describe it,

  • -f puts it in the background
  • -N tells ssh there is no command to execute
  • -L 9999:localhost:3306 tells to bind the local port 9999 to 3306 remotely.

Then I use MySQL Query browser and tell it to connect to 127.0.0.1 port 9999

So I suppose you could try:

ssh -fNL 9009:localhost:27017 myuser@myremotemachine
Weboide
  • 3,345
  • 1
  • 25
  • 33