从其他服务器访问MongoDB(Access MongoDB from other server)

系统教程 行业动态 更新时间:2024-06-14 16:59:17
从其他服务器访问MongoDB(Access MongoDB from other server)

我的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 ;)

更多推荐

本文发布于:2023-04-16 14:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/f40a0a110b03c2c77019fd0e98e7229d.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器   MongoDB   server   Access

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!