linux - 启动数据库 : mongod failed

标签 linux mongodb

我无法在我的服务器上安装 mongodb(ssh;linux-gnu)。得到以下痕迹:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  mongodb-org-mongos mongodb-org-server mongodb-org-tools
The following NEW packages will be installed:
  mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-tools
0 upgraded, 4 newly installed, 0 to remove and 47 not upgraded.
Need to get 0 B/46.7 MB of archives.
After this operation, 149 MB of additional disk space will be used.
Selecting previously deselected package mongodb-org-server.
(Reading database ... 73280 files and directories currently installed.)
Unpacking mongodb-org-server (from .../mongodb-org-server_3.0.5_amd64.deb) ...
Selecting previously deselected package mongodb-org-mongos.
Unpacking mongodb-org-mongos (from .../mongodb-org-mongos_3.0.5_amd64.deb) ...
Selecting previously deselected package mongodb-org-tools.
Unpacking mongodb-org-tools (from .../mongodb-org-tools_3.0.5_amd64.deb) ...
Selecting previously deselected package mongodb-org.
Unpacking mongodb-org (from .../mongodb-org_3.0.5_amd64.deb) ...
Processing triggers for man-db ...
Setting up mongodb-org-server (3.0.5) ...
Starting database: mongod failed!
invoke-rc.d: initscript mongod, action "start" failed.
dpkg: error processing mongodb-org-server (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up mongodb-org-mongos (3.0.5) ...
configured to not write apport reports
                                      Setting up mongodb-org-tools (3.0.5) ...
dpkg: dependency problems prevent configuration of mongodb-org:
 mongodb-org depends on mongodb-org-server; however:
  Package mongodb-org-server is not configured yet.
dpkg: error processing mongodb-org (--configure):
 dependency problems - leaving unconfigured
configured to not write apport reports
                                      Errors were encountered while processing:
 mongodb-org-server
 mongodb-org
E: Sub-process /usr/bin/dpkg returned an error code (1)

我一直在遵循 official documentation 的指示。

我试过 repair it ,但没用。

mongod --repair 
2015-08-03T09:11:28.456+0200 I STORAGE  [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2015-08-03T09:11:28.456+0200 I CONTROL  [initandlisten] dbexit:  rc: 100

我也尝试过 install locales ,但它也没有帮助。

我怎样才能解决这个问题并安装 mongodb?可能是什么错误?

最佳答案

在 Yosemite 上成功安装 MongoDB(通过 Homebrew)后,会显示以下说明:

To have launchd start mongodb at login:
  ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

Then to load mongodb now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

Or, if you don't want/need launchctl, you can just run:
  mongod --config /usr/local/etc/mongod.conf

/usr/local/etc/mongod.conf”包含“dbpath”参数。查看该文件后,我还能够按如下方式启动 MongoDB:

$ mongod --dbpath/usr/local/var/mongodb

在 Linux 环境中,您的路径可能不同,但我希望这有助于回答您的问题并为您提供解决问题的方向。

关于linux - 启动数据库 : mongod failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31781468/

相关文章:

javascript - Mongo文档到数组

c# - GridFS 发生了什么?

多种用户类型的 MongoDB 模式设计

linux - 由于 armhf 导致的 apt-get 更新错误

c++ - 如何编译程序以使其能够在 32 位 Linux 上使用 >4GB 内存?

linux - Linux中的快速排序 "back off"是否实现为插入排序?

MongoDB、Riak 和 HyperTable(或 HBase)的内存需求/利用率

linux - 使用 shell 遍历 json

c - C 和 Linux 中的时间测量

mongodb - 日期范围在聚合管道中不起作用,但在 find() 中起作用