Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Connecting to remote mongodb database via SSH

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 1.58k
    Comment on it

    Hi friends,
    So many times developer face an issue of not able to connect to their mongo db using a GUI tool, If the mongo is installed on a remote server

    There is a solution of connecting to remotely installed mongodb via SSH
    First open your terminal and hit the following command

    ssh -i SSH_KEY_PATH -fN -L 6666:localhost:27017 USER@IP
    


    Here the SSH_KEY_PATH is the path of the ssh key and replace the 6666 with any local port which is free in your local system, on this port the mongodb will be mounted. localhost:27017 will be the port where your mongodb db is running remotely. and the last part is the user and server ip of your server.

    After this is done the mongodb will be mounted on the given port of your local system and you can connect to it from any of the GUI tool
    Suppose you are using ROBOMONGO, then you need to go to create connection and specify the port number and then save and then connect, Thus you are automatically connected to mongodb database,

    alt text

    Thanks for reading this blog, hope you like this,

    Connecting to remote mongodb database via SSH

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: