简体   繁体   English

在 Virtualbox 托管的 Ubuntu 中通过 Robomongo 访问 mongodb

[英]Access mongodb by Robomongo in Virtualbox hosted Ubuntu

I am trying to access Mongodb in the virtualbox hosted Ubuntu.我正在尝试在托管 Ubuntu 的 virtualbox 中访问 Mongodb。 When I am developing app in Ubuntu, I used "meteor create {app_name}"当我在 Ubuntu 中开发应用程序时,我使用了“meteor create {app_name}”

I didnt change the default Mongodb.我没有更改默认的 Mongodb。 So when I am running Meteor app using "meteor" command, I cant access the mongodb.因此,当我使用“meteor”命令运行 Meteor 应用程序时,我无法访问 mongodb。

In my Robomongo app in Windows, I am using this credentials,在 Windows 中的 Robomongo 应用程序中,我正在使用此凭据,

"192.168.1.13:3001" as host and port. “192.168.1.13:3001”作为主机和端口。 But It says "failed to connect".但它说“无法连接”。

What Do i need to do to connect to my mongodb?我需要做什么才能连接到我的 mongodb?

Hey After doing some digging I find out the solution.嘿 做了一些挖掘后,我找到了解决方案。

steps you need to follow:您需要遵循的步骤:

  1. Go to the following path cd /etc转到以下路径cd /etc
  2. There you will find a file called mongod.conf open this file with the help of在那里你会找到一个名为mongod.conf 的文件,在帮助下打开这个文件

sudo vim mongod.conf须藤vim mongod.conf

3.You will be in a file type i and find bindIp written over there. 3.您将在文件类型 i 中找到写在那里的 bindIp。

4.now you need to change your bindIp of mongodb to 0.0.0.0 4.现在你需要把你的mongodb的bindIp改成0.0.0.0

5.type ctrl +c then :wq // write and quite 5.type ctrl +c then :wq // 写入并相当

6.sudo service mongod restart 6.sudo 服务 mongod 重启

7.Go to your robomongo and create connection and in address field just type your ip (192.168.1.13) // no port number is required in which you are running the code port will be default port on which mongodb runs 27017 7.转到您的robomongo并创建连接并在地址字段中输入您的ip(192.168.1.13)//不需要您运行代码的端口号端口将是mongodb运行的默认端口27017

我发现在 mongod.conf 中不使用绑定 ip 并将 localhost 127.0.0.1 添加到 hosts.conf 工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM