MongoDB Unclean Shutdown - Failed to recover

I ran MongoDB on Amazon AWS until one day I ran out of free space. Then the database is completely unavailable, and I tried to close the database. After rebooting the server and installing a larger disk, MongoDB cannot be started. I tried to restore the database and the error is shown below:

Wed Aug 15 10:08:04 [initandlisten] MongoDB start: pid = 1447 port = 27017 dbpath = / var / lib / mongodb / 32-bit

** NOTE: when using the 32-bit MongoDB file, you are limited to approximately 2 gigabytes of data ** see http://blog.mongodb.org/post/137788967/32-bit-limitations ** with --dur, the limit is lower

Wed Aug 15 10:08:04 [initandlisten] version db v1.8.3, pdfile version 4.5 Wed Aug 15 10:08:04 [initandlisten] git version: c206d77e94bc3b65c76681df5a6b605f68a2de05 Wed Aug 15 10:08:04 [initandlisten] build sys info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen # 1 SMP Fri 15 Feb 12:39:36 EST 2008 i686 BOOST_LIB_VERSION = 1_37 Wed Aug 15 10:08:04 [initandlisten] * * Wed Aug 15 10:08:04 [initandlisten] ** Wed Aug 15 10:08:04 [initandlisten] you need to update the md database using pdfile version 559903.1345021735, new version: 4.5 Wed Aug 15 10:08:04 [initandlisten ] Starting the update Wed Aug 15 10:08:04 [initandlisten] md repairDatabase md Wed Aug 15 10:08:04 [initandlisten] md.system.namespaces Approval error isOk () db / pdfile.h 259 0x817c27b 0x819121e 0x83cf525 0x83d6bec 0x83f4207 0x83f4207 0x83f8680 0x83fcece 0x8401358 0x8401e29 0x8402abd 0x828 f755 0x83b3d67 0x83b931c 0x83bb3df 0x81ce25f 0x81ae714 0x8380f31 0x83831ba 0x83d4faf mongod (_ZN5mongo12sayDbContextEPKc + 0xcb) [0x817c27b] mongod (_ZN5mongo8assertedEPKcS1_j + 0x12e) [0x819121e] mongod (_ZN5mongo11DataFileMgr7findAllEPKcRKNS_7DiskLocE + 0x7a5) [0x83cf525] mongod (_ZN5mongo13findTableScanEPKcRKNS_7BSONObjERKNS_7DiskLocE + 0x13c) [0x83d6bec] mongod (_ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocEi + 0x830 ) [0x83f5420] mongod (_ZN5mongo11UserQueryOp5_initEv + 0x437) [0x82a4fb7] mongod (_ZN5mongo12QueryPlanSet6Runner6initOpERNS_7QueryOpE + 0x110) [0x83f8680] mongod (_ZN5mongo12QueryPlanSet6Runner3runEv + 0x2ee) [0x83fcece] mongod (_ZN5mongo12QueryPlanSet5runOpERNS_7QueryOpE + 0x2e8) [0x8401358] mongod (_ZN5mongo16MultiPlanScanner9runOpOnceERNS_7QueryOpE + 0x59) [0x8401e29] mongod (_ZN5mongo16MultiPlanScanner5runOpERNS_7QueryOpE + 0x2d) [0x8402abd] mongod (_ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_xx8_0x8x_8x8x_8x0xm_8x8_0x8c8a_0x8c8a_0xx8b5_8 0x8f075cf0b5c5c5cbf ... 7] mongod (_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_8SockAddrE + 0x70c) [0x83b931c] mongod (_ZN5mongo14DBDirectClient4callERNS_7MessageES2_bPSs + 0x7f) [0x83bb3df] mongod (_ZN5mongo14DBClientCursor4initEv + 0x15f) [0x81ce25f] mongod (_ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 0x2a4) [0x81ae714] mongod (_ZN5mongo6Cloner2goEPKcRSsRKSsbbbb + 0x451) [0x8380f31] mongod (_ZN5mongo9cloneFromEPKcRSsRKSsbbbb + 0x5a) [0x83831ba] mongod (_ZN5mongo14repairDatabaseESsRSsbb + 0x38f) [0x83d4faf] Wed Aug 15 10:08:04 [initandlisten] statement 0 statement db / pdfile.h: 259 ns: md.system.namespaces query: {} Wed 10:08:04 [initandlisten] Adoption: 10,290: bad system.namespaces object {$ err: "assertion db / pdfile.h: 259"} 0x819045e 0x8381181 0x83831ba 0x83d4faf 0x852a30c 0x852b217 0x852e733 0x852f59c 0x85366bb 0xb74a4ce7 0x810b551 mongod (_ZN5mongo11msgassertedEiPKc + 0x15e) [ 0x819045e] mongod (_ZN5mo ngo6Cloner2goEPKcRSsRKSsbbbb + 0x6a1) [0x8381181] mongod (_ZN5mongo9cloneFromEPKcRSsRKSsbbbb + 0x5a) [0x83831ba] mongod (_ZN5mongo14repairDatabaseESsRSsbb + 0x38f) [0x83d4faf] mongod (_ZN5mongo11doDBUpgradeERKSsSsPNS_14DataFileHeaderE + 0x6c) [0x852a30c] mongod () [0x852b217] mongod (_ZN5mongo14_initAndListenEiPKc + 0x4b3) [0x852e733] mongod (ZN5mongo13initAndListenEiPKc + 0x2c) [0x852f59c] mongod (main + 0x6bdb) [0x85366bb] /lib/libc.so.6(_libc_start_main+0xe7) [0xb74a4ce7] 0xn10b (10) exception in initAndListen std :: exception: bad system.namespaces object {$ err: "assertion db / pdfile.h: 259"}, completed Wed Aug 15 10:08:04 dbexit: Wed Aug 15 10:08:04 [initandlisten ] shutdown: about to close listening sockets ... Wed Aug 15 10:08:04 [initandlisten] shutdown: about to reset the diagnostics ... Wed Aug 15 10:08:04 [initandlisten] shu tdown: about to close the sockets ... Wed Aug 15 10:08:04 [initandlisten] shutdown: waiting for fs preallocator ... Wed Aug 15 10:08:04 [initandlisten] shutdown: closing all files ... Wed Aug 15 10 : 08: 04 closeAllFiles () completed Wed Aug 15 10:08:04 [initandlisten] shutdown: removing fs lock ... Wed Aug 15 10:08:04 dbexit: really coming out now

I have all the * .number and * .ns file completely. But it looks like the ns file is corrupt. How can I restore the database?

thanks

+1
source share
1 answer

If the repair does not work, you are unfortunately unlucky.

I assume that you did not have logging or any backups. I highly recommend that you run with the log enabled and follow one of the backup strategies described here . The LVM tray is easy to implement, fairly fast and reliable.

You better run MongoDB on a 64-bit system as well. 32-bit restrictions on 2gb data . Are you saying that you "ran out of space"?

+1
source

All Articles