MongoDB常见启动错误与解决方法汇总
在近期配置MongoDB的过程中,遇到并解决了若干典型错误,现将这些问题的现象及处理方法整理如下,供参考。
日志显示:2026-05-12T09:30:26.313+0800 I STORAGE [initandlisten] exception in initAndListen: 28574 Cannot start server. Detected data files in /root/Desktop/mongodb/data created by storage engine 'mmapv1'. The configured storage engine is 'wiredTiger'., terminating 2026-05-12T09:30:26.313+0800 I CONTROL [initandlisten] dbexit: rc: 100 2026-05-12T09:31:53.043+0800 I CONTROL ***** SERVER RESTARTED ***** 2026-05-12T09:31:53.049+0800 I STORAGE [initandlisten] exception in initAndListen: 28574 Cannot start server. Detected data files in /root/Desktop/mongodb/data created by storage engine 'mmapv1'. The configured storage engine is 'wiredTiger'., terminating 2026-05-12T09:31:53.050+0800 I CONTROL [initandlisten] dbexit: rc: 100
补充说明:若磁盘存储空间耗尽,同样可能触发rc:100错误。总体而言,rc:100通常指向系统文件层面的异常。
该错误的根源在于:此前由mmapv1存储引擎创建的数据目录,无法直接被wiredTiger引擎读取。解决方法是重新指定正确的dbpath路径。
[root@localhost Desktop]# Python mongodb.py about to fork child process, waiting until server is ready for connections. about to fork child process, waiting until server is ready for connections. forked process: 36411 forked process: 36412 about to fork child process, waiting until server is ready for connections. forked process: 36414 ERROR: child process failed, exited with error number 100 ERROR: child process failed, exited with error number 100 ERROR: child process failed, exited with error number 100
此情况通常由MongoDB非正常关闭引起,导致锁文件残留。只需删除mongod.lock文件即可恢复正常。
ERROR: child process failed ,exited with error number 1
原因是dbpath所在目录缺乏必要的写入权限,赋予相应的写权限后即可解决。
检查mongodb.conf配置文件,若bind_ip设置为127.0.0.1,将导致其他主机无法连接,需调整为允许远程访问的地址。
上述情况并非唯一解法,具体场景可能有所不同,此处提供的是通用的排查思路。
child process failed, exited with error number 1

child process failed, exited with error number 48

child process failed, exited with error number 100

在安装MongoDB后次日尝试启动服务时,遭遇启动失败,具体报错信息如下:
错误:
错误2:系统找不到指定文件

思考过程:
昨日进行测试时,先后安装了两次MongoDB,随后手动删除(注意非卸载)了其中一个MongoDB文件夹。当前怀疑服务是否仍指向已删除的旧安装路径。
查看服务属性发现,MongoDB的服务地址仍指向已被删除的旧目录,而非当前实际使用的E:\Program files\mongodb\bin。

解决方式:
先彻底移除旧的安装记录,再重新安装新的服务。
Mongo卸载:
执行命令卸载:mongod.exe --remove --serviceName "MongoDB"

MongoDB安装为服务:
执行命令安装:mongod.exe --install --logpath="E:\Program files\mongodb\data\log\log.txt" --dbpath="E:\Program files\mongodb\data\db"

安装完成后刷新服务列表,确认服务地址已更新为正确路径。

再次尝试启动MongoDB服务,依然失败,此次出现1607错误代码。
错误:

错误原因:不明
解决方式:
进入E:\Program files\mongodb\data\db目录,删除其中的mongod.lock文件。
清除锁文件后重启服务,MongoDB成功启动。
总结:
接触新技术时难免遇到各种错误,面对问题时不应回避或拖延,而应积极排查并解决。