Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access MongoDB from other server

Tags:

mongodb

robo3t

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

How can I get the authentication credentials? Or should I change something in MongoDB before I can acces the database from another server / pc?

Someone else have set up this database, and there is no possibility to ask him this questions.

like image 855
Marten Avatar asked May 15 '26 03:05

Marten


2 Answers

I have found the solution by my self:

The File etc/mongod.conf has a line 'bind_ip'. In this line, you originally have to add the IP address which you want to access your database. But, it don't work! You should better comment this line.

But, you don't have any authentication now, so you have to add authentication. Here you have an tutorial about this: http://ghosttx.com/2012/03/how-to-connect-to-a-remote-mongodb-server-with-mongohub-for-mac/

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

Now you can connect with you Mongo Database ;)

like image 118
Marten Avatar answered May 18 '26 01:05

Marten


Ive sorted it by adding ssh option to RoboMongo following this link:

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

Im on OSX and connecting to Ubuntu 14 / Mongo 2.6.7 on VPS and when Ive added my ssh details to the Robomongo all seem to work ok (Ive also changed the mongo config to remove the ip_bing and enabled port 27017)

like image 32
digitalM Avatar answered May 18 '26 03:05

digitalM