Connecting to a remote server over SSH

Many users have their MongoDB instance running on a remove server (say in AWS or some other cloud) and for security reasons all/most of the ports on this server are purposely blocked including port number 27017 (which is the default one for MongoDB).

Now MongoVUE doesn’t natively support SSH protocol. So you cannot directly connect to these servers over SSH. Also, there are no SSH options in MongoVUE connections dialog!
mongovue-cannot-ssh-to-server

But there is some good news too. It is fairly easy to setup an SSH tunnel between your PC (client) and your server, and MongoVUE can use this tunnel to connect to your remotely running MongoDB instance.

mongovue-use-ssh-tunnel-on-putty

Let us do this stepwise.

Step 1

Download and install PuTTY. This software will be used to setup SSH tunnel.

 

Step 2

Launch PuTTY, and navigate to the “Connection > SSH > Tunnels” screen

PuTTY SSH Tunnel screen

 

Step 2

For “Source port”, enter the port number you want to utilize on your client PC. We’ll use “5151”.

For “Destination”, enter the IP and port on the remove server to which you wan to connect to. Here we’ll use “127.0.0.1:27017”.

Select the “IPv4” radio button

Configure local port and destination info

 

Step 3

Click the “Add” button

Click the "Add" button

 

Step 4

Now click the “Session” category on the left, and enter IP of your remote server under “Host Name”.

Enter remove server IP

 

Step 5

Click the “Open” button. You will be asked to enter your user and password info on the shell. Once you login, your SSH tunnel is setup!

 

Step 6

We are almost done. Lets fire up MongoVUE and open a new connection windows. On this windows, the server and port number we enter are for PC client end of SSH tunnel. Now if our MongoDB needs some authentication, we can enter that in Username and Password fields.

 

Enter your port number plus auth info

 

Hit the “Save” button and then open the connection!

2 Comments