我正在构建一个MongoDB虚拟机,但实际上无法使用它。输出如下:
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
[master 462b01d] saving uncommitted changes in /etc prior to apt run
Author: root <root@mongo>
1 files changed, 5 insertions(+), 5 deletions(-)
Setting up mongodb-10gen (2.4.5) ...
Starting database: mongodb failed!
invoke-rc.d: initscript mongodb, action "start" failed.
dpkg: error processing mongodb-10gen (--configure):
subprocess installed post-installation script returned error exit status 1
configured to not write apport reports
Errors were encountered while processing:
mongodb-10gen
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@mongo:~#
我一直关注mongodb网站上的官方install instructions。我找到了this patch fix,但这也没有解决错误,只是抛出一个新错误。我也看到从dpkg / status中删除一个坏包可以修复错误,但我甚至不知道从哪里开始。
编辑1
我按照顶部voted answer here中的步骤操作,现在我可以访问mongo shell,但是当我service mongodb start
时,它仍然显示失败。我之前无法访问shell,是的,是吗?
root@mongo:~# service mongodb start
Starting database: mongodb failed!
root@mongo:~# mongo
MongoDB shell version: 2.4.5
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
> ^C
bye
root@mongo:~#
答案 0 :(得分:4)
如果您在日志中找不到任何痕迹:
tail -f -n50 /var/log/mongodb/mongodb.log
你应该尝试在前台启动服务器:
sudo -u mongodb mongod --dbpath /var/lib/mongodb/
看看发生了什么。 例如,我遇到了语言环境问题。
答案 1 :(得分:0)
检查您的日志“/var/log/mongodb/mongodb.log
请将您的日志粘贴到此处。
可能与几件事有关。你有多少hdd空间免费? 可能与日记有关。 默认情况下,MongoDB在/ journal中至少需要3379MB 根据您安装MongoDB的原因,您可以更改配置以使用“smallfiles”,这将占用512MB文件,虽然它会随着它的增长而变慢,因为文件将被分开,或者禁用日志,而不是可取。 希望这会有所帮助。
答案 2 :(得分:0)
我遇到了同样的错误消息。就我而言,问题是我在$ LOCALE环境中指定的语言环境(en_US.UTF-8)变量未被Linux识别。
(每当我打开一个bash shell时,我也会收到关于setlocale的警告。)
在我的情况下,在安装work之前执行以下操作:
locale-gen en_US.UTF-8
答案 3 :(得分:-3)
我有完全相同的错误消息,对我有帮助的是从我的/ etc / hosts文件中注释掉每个回送(127.0.0.1,:: 1)条目。
通常是这样的:
127.0.0.1 localhost
::1 localhost
然后尝试启动服务器。
如果这没有帮助,请粘贴您的MongoDB日志。
cat /var/log/mongodb/mongodb.log