博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mongodb启动不了:child process failed, exited with error number 48
阅读量:4607 次
发布时间:2019-06-09

本文共 1784 字,大约阅读时间需要 5 分钟。

问题:

启动mongodb的时候,发现起不来,报错:child process failed, exited with error number 48然后先去/var/log/mongo/mongod.log 查看启动的日志

 

可能原因:

应该是没有正常关闭mongodb引起的,比如直接 kill -9 <pid>导致

 

解决方法:

1.找到mongod.lock文件,并删除mongod.lock

 

2.以修复方式启动mongodb

/usr/bin/mongod -f /etc/mongod.conf --repair

 

3.然后接着在启动一次

/usr/bin/mongod -f /etc/mongod.conf --auth

 

4.查看进程是否运行

ps aux|grep mongo

 

正确关闭mongodb的方法

 

warning:千万不能使用kill -9 <pid>,因为MongoDB使用mmap方式进行数据文件管理,也就是说写操作基本是在内存中进行,写操作会被每隔60秒(syncdelay设定)的flush到磁盘里。如果在这60秒内flush处于停止事情我们进行kill -9那么从上次flush之后的写入数据将会全部丢失。

如果在flush操作进行时执行kill -9则会造成文件混乱,可能导致数据全丢了,启动时加了repair也无法恢复。

 

 

官方文档:https://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/

Stop mongod Processes

In a clean shutdown a  completes all pending operations, flushes all data to data files, and closes all data files. Other shutdowns are unclean and can compromise the validity of the data files.

To ensure a clean shutdown, always shutdown  instances using one of the following methods:

Use shutdownServer()

Shut down the  from the  shell using the  method as follows:

use admindb.shutdownServer()

Calling the same method from a  accomplishes the same result.

For systems with  enabled, users may only issue  when authenticated to the admin database or via the localhost interface on systems without authentication enabled.

Use --shutdown

From the Linux command line, shut down the  using the --shutdown option in the following command:

mongod --shutdown

Use CTRL-C

When running the  instance in interactive mode (i.e. without --fork), issue Control-C to perform a clean shutdown.

Use kill

From the Linux command line, shut down a specific  instance using the following command:

kill 

WARNING

Never use kill -9 (i.e. SIGKILL) to terminate a mongod instance.

转载于:https://www.cnblogs.com/joshua317/articles/5190385.html

你可能感兴趣的文章
恩如氏--蜗牛精华补水蚕丝面膜
查看>>
大工具-收藏
查看>>
codevs3027 线段覆盖 2
查看>>
markdown
查看>>
【leetcode】107-Binary Tree Level Order Traversal II
查看>>
Jquert data方法获取不到数据,显示为undefined。
查看>>
ssm项目中 数据库和资源的备份
查看>>
HDU5950【矩阵快速幂】
查看>>
在线C++编译器
查看>>
C#中各种serialization的比较
查看>>
P2617 Dynamic Rankings
查看>>
工作学习常识1
查看>>
github开发
查看>>
Emacs学习笔记(13):在Emacs中打开pdf
查看>>
flask模板应用-空白控制 --
查看>>
学习过程笔记 7月上
查看>>
ASP.NET WebAPI String 传值问题
查看>>
【2017-3-1】冒泡排序
查看>>
[转载]后缀数组算法总结
查看>>
pandas数据结构练习题(部分)
查看>>