我的Linux服务器上有一个MongoDB数据库。 我想从另一台服务器访问它。 我尝试从本地计算机与Robomongo建立连接。 连接成功,但验证失败。
我如何获得身份验证凭证? 或者我应该改变MongoDB中的某些东西,然后才能从另一台服务器/ PC访问数据库?
其他人已经建立了这个数据库,并且没有可能向他提出这个问题。
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.
最满意答案
我已经找到了我自己的解决方案:
文件etc / mongod.conf有一行'bind_ip'。 在这一行中,您最初必须添加要访问数据库的IP地址。 但是,它不起作用! 你应该更好地评论这一行。
但是,您现在没有任何身份验证,因此您必须添加身份验证。 这里有一个关于这个的教程: http : //ghosttx.com/2012/03/how-to-connect-to-a-remote-mongodb-server-with-mongohub-for-mac/
完成后,您必须启用身份验证。 您可以通过再次编辑etc / mongod.conf来完成此操作,并取消注释'Auth = true'行。
现在你可以连接你Mongo数据库;)
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 ;)
更多推荐
发布评论