How do I connect robomongo to my droplet

August 26, 2015 4.3k views
MongoDB Configuration Management

I cannot seem to figure out how to connect my local tool "Robomongo" to my droplet running "Ubuntu MongoDB 3.0.5 on 14.04"

6 comments
  • Did you manage to figure it out? I am at the exact stage right now.

  • I am also looking for a solution for this, please advice, thanks in advance!

  • in the "Connection" panel:
    Address - localhost
    Port - 27017

    in the "SSH" panel:
    Address - <your_ip_or_fqdn>:22
    and use a private key auth.

    This will connect via port 22 and redirect traffic sent to port 27017

    Mongo on your droplet is set to respond only to traffic from localhost which is where the ssh tunnel comes in handy. Running db.serverCmdLineOpts() from the mongoshell will tell you what it is bound to.

  • Dam this isnt working for me. Is the address localhost or my domain name?

    Same question for the SSH bit.

  • I just ended up using AWS

  • I "kinda" figured it out:
    You have to open the firewall to accept incoming connections on port 22 and port 27017 using ufw (refer to Digital Ocean's ufw tutorial)

    In your droplet:

    $ sudo ufw allow 27017
    $ sudo ufw allow 22
    

    and to check if it worked:

    $ sudo ufw status
    

    Now you have to change your mongod.conf file:

    $ sudo vim /etc/mongod.conf
    

    then go to line 23 and it should read:

    bindIp: 127.0.0.1
    

    change it to:

    bindIp: 0.0.0.0
    

    (do not add extra lines or spaces to this file, even if it is a comment).

    then run

    $ sudo systemctl restart mongodb
    $ sudo systemctl status mongodb
    

    and it should be active.
    Go to Robomongo under 'Connection' tab:
    Address: your droplet address

    connect normally.
    I "kinda" figured it out because you cannot use this solution in production because it will accept any incoming IP connection to your database; which is not recommended.
    If I figure out how to do it with the tunnel or in a way that accepts only IPs authorized; I'll let you know!

1 Answer

This question was answered by @vincro:

in the "Connection" panel:
Address - localhost
Port - 27017

in the "SSH" panel:
Address - <your_ip_or_fqdn>:22
and use a private key auth.

This will connect via port 22 and redirect traffic sent to port 27017

Mongo on your droplet is set to respond only to traffic from localhost which is where the ssh tunnel comes in handy. Running db.serverCmdLineOpts() from the mongoshell will tell you what it is bound to.

View the original comment

Have another answer? Share your knowledge.