paskowski
By:
paskowski

Robomongo connection Ubuntu 16.04

February 27, 2017 1.2k views
MongoDB Ubuntu 16.04

Hello

I've read all the posts on connecting robomongo to my droplet with Ubuntu 16.04 but I just can't get it done. I would be very thankful for any help.

Best,
Stan

1 comment
3 Answers

Here's the robomongo (v 1.0.0) setup:

Connection tab

  • Address: localhost
  • Port: 27017

Authentication tab

  • "Perform Authentication" is turned off

Advanced tab

  • Default Database is left blank

SSL tab

  • "Use SSL Protocol" is not checked

SSH tab

  • "Use SSH tunnel" is checked
  • "SSH Address" first field is my server's IP address, second field is the port "22" as was default
  • "SSH User Name": your private key enabled user
  • "SSH Auth Method": Set to Private Key
  • "Private Key": Click the ... button to select your file
  • "Passphrase": left blank or filled as you prefer

Beware that the private key should be in OpenSSH format. If it is the case you may convert a putty key (ppk) with the "Putty Gen" app.

Additional details and tips here.

@paskowski

From looking at the configuration, MongoDB is much like MySQL/MariaDB in that it uses a variable to control the bind IP. The default configuration seems to use bind_ip = 127.0.0.1, which means that it'll only accept connections locally -- remote connections won't work.

So the option there would be to either comment it out, or bind it to the IP of your Droplet. You'd do this by placing a # before that line to comment it out, or by changing 127.0.0.1 to that of your Droplet Public IPv4 IP address.

You'd then need to restart MongoDB.

I would, however, keep in mind -- much like other database software -- it's not a good idea to openly accept all connections. If you do need to connect remotely, you need to make sure you've setup a working firewall (i.e. ufw on ubuntu) and that you have some sort of rule in place to limit who can connect.

If you are running robomongo on an occasional basis, you can easily connect to your droplet's mongodb instance by setting up an SSH tunnel. Once you have created the forward you can simply connect using localhost:27017 in robomongo

If you are using a *nix based system you can run in a terminal the following:

ssh user@droplet -L 27017:127.0.0.1:27017

If you are using PuTTY as your SSH client, you can add TCP forwarding rules in your PuTTY site configuration under Connection > SSH > Tunnels. Source port will be the port you want to use on your system and the destination in this case would be 127.0.0.1:27017

Either of these methods will allow you to securely access your database without allowing access to the internet.

Have another answer? Share your knowledge.