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,
Thanks for reading this blog, hope you like this,
0 Comment(s)