MongoDB运行错误



有人可以帮我解决首次用户的安装问题吗?

任何帮助将不胜感激,我正在从 Virtualbox 上运行它。

1)我运行"mongod",我得到以下内容:

ERROR: dbpath (/data/db) does not exist. Create this directory or give existing directory in --dbpath. , terminating

2) 我在哪里设置它?我查看/etc/mongod.conf 并看到以下行:(我应该如何更改它?

dbpath=/var/lib/mongodb

3)当我尝试运行"mongo"时,我得到以下结果:

2015-01-19T01:02:38.625-0700 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused

2015-01-19T01:02:38.625-0700 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146

exception: connect failed

4)另外,我没有在127.0.0.1上运行,所以我是否也从mongod.conf文件中更改/设置它或在其他地方设置它?

你试过这个答案吗?

另一件有帮助的事情是使用 --dbpath 参数运行 mongod:

mongod --dbpath /var/lib/mongodb

但首先要确保这是您的数据库目录。

最新更新