• 首页
  • mongodb
  • mongoDB启动报错 ERROR: child process failed, exited with error number

mongoDB启动报错 ERROR: child process failed, exited with error number

上面这个错误是今天下午发现,从github down下一个应用,在应用启动前需要redis 启动服务,mongodb启动服务,所以当启动mongodb的时候悲剧出现了:

zhangzhi@moke:~$ mongod --dbpath=/data/club --port=27017 --fork --logpath=/var/log/mongodb/mongodb.log
about to fork child process, waiting until server is ready for connections.
forked process: 43110
all output going to: /var/log/mongodb/mongodb.log
log file [/var/log/mongodb/mongodb.log] exists and couldn't make backup [/var/log/mongodb/mongodb.log.2014-11-17T06-55-20]; run with --logappend or manually remove file: errno:13 Permission denied
Bad logpath value: "/var/log/mongodb/mongodb.log"; terminating.
ERROR: child process failed, exited with error number 1


出现这种错误的原因:

大部分是因为mongodb 服务在不正常关闭的情况下,mongod 被锁,想想可能是上次无故死机造成的.


如何解决这种问题:

  1. 删除 mongod.lock 文件和日志文件 mongodb.log.2014-11-17T06-55-20 ,如果有必要把 log日志全部删除

  2. mongod --repair --dbpath /data/db / --repairpath /tmp/mongodb


root@moke:~# mongod --repair --dbpath /data/db/ --repairpath /tmp/mongodb
Mon Nov 17 15:19:15.374 You must use a --repairpath that is a subdirectory of --dbpath when using journaling
Mon Nov 17 15:19:15.375 dbexit:
Mon Nov 17 15:19:15.375 shutdown: going to close listening sockets...
Mon Nov 17 15:19:15.375 shutdown: going to flush diaglog...
Mon Nov 17 15:19:15.375 shutdown: going to close sockets...
Mon Nov 17 15:19:15.375 shutdown: waiting for fs preallocator...
Mon Nov 17 15:19:15.376 shutdown: lock for final commit...
Mon Nov 17 15:19:15.376   Assertion failure c src/mongo/db/client.h 235
0x1033e4d80 0x1033b85e7 0x10305cd47 0x10305cb1a 0x10305ce97 0x10305e33d 0x10305fd75 0x10312e69d 0x102ef6c63 0x102ef26fd 0x7fff8dd185c9
 0   mongod                              0x00000001033e4d80 _ZN5mongo15printStackTraceERSo + 64
 1   mongod                              0x00000001033b85e7 _ZN5mongo12verifyFailedEPKcS1_j + 295
 2   mongod                              0x000000010305cd47 _ZN5mongo4Lock26ParallelBatchWriterSupport6relockEv + 391
 3   mongod                              0x000000010305cb1a _ZN5mongo4Lock26ParallelBatchWriterSupportC2Ev + 26
 4   mongod                              0x000000010305ce97 _ZN5mongo4Lock10ScopedLockC2Ec + 39
 5   mongod                              0x000000010305e33d _ZN5mongo4Lock10GlobalReadC2Ei + 29
 6   mongod                              0x000000010305fd75 _ZN5mongo11readlocktryC2Ei + 53
 7   mongod                              0x000000010312e69d _ZN5mongo6dbexitENS_8ExitCodeEPKc + 893
 8   mongod                              0x0000000102ef6c63 _ZL25processCommandLineOptionsRKSt6vectorISsSaISsEE + 14755
 9   mongod                              0x0000000102ef26fd main + 637
 10  libdyld.dylib                       0x00007fff8dd185c9 start + 1
Mon Nov 17 15:19:15.420 shutdown failed with exception
Mon Nov 17 15:19:15.420 dbexit: really exiting now


然后 mongod --dbpath=/data/db  --port=27017  --fork --logpath=/val/log/mongodb/mongodb.log

root@moke:~# mongod --dbpath=/data/db --port=27017 --fork --logpath=/var/log/mongodb/mongodb.log
about to fork child process, waiting until server is ready for connections.
forked process: 43144
all output going to: /var/log/mongodb/mongodb.log
log file [/var/log/mongodb/mongodb.log] exists; copied to temporary file [/var/log/mongodb/mongodb.log.2014-11-17T07-21-41]
child process started successfully, parent exiting


OK,mongodb 后台启动成功.



回到顶部