MongoDB:错误:子进程失败,以错误号 14 退出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30476447/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
MongoDB: ERROR: child process failed, exited with error number 14
提问by Luster
I run MongoDB on Mac:
我在 Mac 上运行 MongoDB:
Shave:mongodb_simple Logan$ ./bin/mongod -f conf/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 5110
ERROR: child process failed, exited with error number 14
Is that because I shutdown it in wrong way?
那是因为我以错误的方式关闭它吗?
采纳答案by compuhosny
It's because you haven't configured your mongod
instance correctly in the config file that you passed to the -f
option.
Revisit your config file and make sure eveything is configured correctly.
这是因为您没有mongod
在传递给-f
选项的配置文件中正确配置您的实例。重新访问您的配置文件并确保所有内容都配置正确。
回答by julien bouteloup
You started and probably shutdown mongo in the wrong way.
您以错误的方式启动并可能关闭了 mongo。
1. TO START MONGODB
1.启动MongoDB
To start mongo in the background type: mongod --dbpath /data/db --fork --logpath /dev/null
.
要在后台启动类型蒙戈:mongod --dbpath /data/db --fork --logpath /dev/null
。
/data/db
is the location of the db. If you haven't created one yet => type:mkdir /data/db
--fork
means you want to start mongo in the background - deamon.--logpath /dev/null
means you don't want to log - you can change that by replacing/dev/null
to a path like/var/log/mongo.log
/data/db
是数据库的位置。如果你还没有创建一个 => 输入:mkdir /data/db
--fork
意味着你想在后台启动 mongo - deamon。--logpath /dev/null
意味着您不想记录 - 您可以通过替换/dev/null
为类似的路径来更改它/var/log/mongo.log
2. TO SHUTDOWN MONGODB
2.关闭MongoDB
Connect to your mongo by typing: mongo
and then use admin
and db.shutdownServer()
. Like explain in mongoDB
通过键入:mongo
然后use admin
和连接到您的 mongo db.shutdownServer()
。就像在mongoDB 中解释
If this technique doesn't work for some reason you can always kill the process.
如果此技术由于某种原因不起作用,您可以随时终止该进程。
- Find the mongodb process
PID
by typing:lsof -i:27017
assuming your mongodb is running on port 27017 - Type
kill <PID>
, replace<PID>
by the value you found the previous command.
PID
输入以下命令查找 mongodb 进程:lsof -i:27017
假设您的 mongodb 在端口 27017 上运行- 键入
kill <PID>
,替换<PID>
为您在上一个命令中找到的值。
回答by avck
For me it was ulimit
issue, mongo could not open too many files.
对我来说这是个ulimit
问题,mongo 无法打开太多文件。
Used ulimit -n 10000
.
用过ulimit -n 10000
。
However as a generic pointer look into mongo logs file, they will tell where to look further. Generally the logs file are in /var/log/mongo.log
but look into your mongo config file.
然而,当通用指针查看 mongo 日志文件时,它们会告诉在哪里可以进一步查看。通常日志文件在/var/log/mongo.log
但查看您的 mongo 配置文件。
回答by alemac852
This worked for me:
这对我有用:
run in terminal
在终端运行
sudo rm -rf mongod.lock
export LC_ALL=C
then
然后
sudo mongod --fork --config /xxxx/xx/mongod.conf --logpath /xxx/log/mongodb/mongodb.log
回答by Lithin Joseph
Check the ownership of the file /tmp/mongodb-27017.sock
检查文件的所有权 /tmp/mongodb-27017.sock
It should be mongod
. I got same error since it was root:root
应该是mongod
。我遇到了同样的错误,因为它是root:root
回答by Debashis Prusty
By changing owner to mongodb
for all files under /var/lib/mongodb/
it started working for me:
通过将所有者更改mongodb
为/var/lib/mongodb/
它下的所有文件开始对我来说有效:
chown mongodb:mongodb -R /var/lib/mongodb/
回答by varevarao
I encountered this issue on a GCP managed Compute Engine instance.
As this is the top answer on a Google search for the issue, I'll include what worked for me, and is a documented bug as per MongoDB (jira-link)
我在 GCP 托管的 Compute Engine 实例上遇到了这个问题。
由于这是 Google 搜索该问题的最佳答案,因此我将包括对我有用的内容,并且是根据 MongoDB ( jira-link)记录的错误
On linux systems, if the user running mongod does not have a locale set or the locale is misconfigured, mongod fails to start printing a stack trace.
在 linux 系统上,如果运行 mongod 的用户没有设置语言环境或语言环境配置错误,则 mongod 无法开始打印堆栈跟踪。
The issue can be resolved by combining a few steps:
该问题可以通过结合几个步骤来解决:
- Install the required language packs (ref):
- 安装所需的语言包 ( ref):
sudo apt-get install language-pack-XX
- Run update locale (ref):
- 运行更新区域设置(ref):
sudo update-locale
Restart your session, and check the same mongo command again
IFF the above doesn't work (it didn't for me), just manually add the following to the file at
/etc/default/locale
(ref):
重新启动您的会话,并再次检查相同的 mongo 命令
IFF 上面的不起作用(它对我不起作用),只需手动将以下内容添加到
/etc/default/locale
(ref)的文件中:
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
- Just to admire the absence of those persistent warnings about LC_ALL not being set, run the following:
- 只是为了欣赏没有设置关于 LC_ALL 的那些持续警告的情况,运行以下命令:
sudo dpkg-reconfigure locales
That's all, your MongoDB instance should be good to go now!
就是这样,您的 MongoDB 实例现在应该可以使用了!
回答by Gcap
I had this same issue, but mine was the system clock being off so my SSL cert was technically invalid. Changing to the current date and time worked date --set "<DD M Y H:M>"
Only found this by looking at the mongodb log
我有同样的问题,但我的是系统时钟关闭,所以我的 SSL 证书在技术上无效。更改为当前日期和时间有效date --set "<DD M Y H:M>"
只有通过查看 mongodb 日志才发现这一点