Accessing MongoDB from another server

I have a MongoDB database on my Linux server. I want to access it from another server. I tried to establish a connection from my local computer with Robomongo. The connection is successful, but authentication fails.

How do I get authentication credentials? Or do I need to change something in MongoDB before I can access the database from another server / PC?

Someone else has created this database and there is no way to ask them these questions.

+3


source to share


4 answers


I found a solution myself:

The etc / mongod.conf file has a 'bind_ip' line. On this line, you first need to add the IP address that you want to access your database. But it won't work! You should better comment this line.

But now you have no authentication, so you need to add authentication. Here you have a tutorial about it: http://ghosttx.com/2012/03/how-to-connect-to-a-remote-mongodb-server-with-mongohub-for-mac/



When you've done this, you need to enable authentication. You can do this by editing etc / mongod.conf again and uncomment the "Auth = true" line.

You can now contact you Mongo Database;)

+3


source


Ive sorted it by adding ssh parameter to RoboMongo from this link:

http://www.mongovue.com/2011/08/04/mongovue-connection-to-remote-server-over-ssh/



I'm on OSX and connecting to Ubuntu 14 / Mongo 2.6.7 on a VPS and when Ive added my ssh data for Robomongo seems to work fine (Ive also changed mongo config to remove ip_bing and enabled port 27017)

+2


source


If you don't like worrying about authentication, just create an SSH tunnel:

ssh -fN -l username -i .ssh/id_rsa -L 9999:localhost:27017 remote.com

      

Just connect to mongodb at localhost: 9999 and it will connect to your mongodb on port 27017 on your server at remote.com.

+2


source


I was also unable to use Robomongo with MongoDB 3.0 (connecting from Windows machine to Linux using SSH). The only tool that works for me is MongoChef ( http://3t.io/mongochef/ ).

0


source







All Articles