Error: MMAP private failed with out of memory

Time:2019-11-30

The error is reported as follows:

Mon Sep 16 13:55:35.274 [initandlisten] MongoDB starting : pid=6195 port=27017 dbpath=/var/lib/mongodb 32-bit host=raspberrypi
Mon Sep 16 13:55:35.274 [initandlisten]
Mon Sep 16 13:55:35.275 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
Mon Sep 16 13:55:35.275 [initandlisten] **       32 bit builds are limited to less than 2GB of data (or less with --journal).
Mon Sep 16 13:55:35.275 [initandlisten] **       See http://dochub.mongodb.org/core/32bit
Mon Sep 16 13:55:35.275 [initandlisten]
Mon Sep 16 13:55:35.275 [initandlisten] db version v2.4.14
Mon Sep 16 13:55:35.275 [initandlisten] git version: nogitversion
Mon Sep 16 13:55:35.275 [initandlisten] build info: Linux bm-wb-03 3.19.0-trunk-armmp #1 SMP Debian 3.19.1-1~exp1+plugwash1 (2015-03-28) armv7l BOOST_LIB_VERSION=1_58
Mon Sep 16 13:55:35.275 [initandlisten] allocator: system
Mon Sep 16 13:55:35.278 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", journal: "true", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Mon Sep 16 13:55:35.297 [initandlisten] journal dir=/var/lib/mongodb/journal
Mon Sep 16 13:55:35.298 [initandlisten] recover : no journal files present, no recovery needed
Mon Sep 16 13:55:35.338 [initandlisten] ERROR: mmap private failed with out of memory. You are using a 32-bit build and probably need to upgrade to 64
Mon Sep 16 13:55:35.338 [initandlisten] Assertion: 13636:file /var/lib/mongodb/imoni.5 open/create failed in createPrivateMap (look in log for more information)
0x6d509c 0x6a6330 0x686590 0x686668 0x43e3d4 0x47aa1c 0x2ffa6c 0x2ffe70 0x300b64 0x30132c 0x278030 0x278234 0x17a888 0x17c740 0x15844c 0x764a6718
 /usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x1c) [0x6d509c]
 /usr/bin/mongod(_ZN5mongo10logContextEPKc+0x110) [0x6a6330]
 /usr/bin/mongod(_ZN5mongo11msgassertedEiPKc+0xc0) [0x686590]
 /usr/bin/mongod(_ZN5mongo18msgassertedNoTraceEiPKc+0) [0x686668]
 /usr/bin/mongod(_ZN5mongo8MongoMMF13finishOpeningEv+0x36c) [0x43e3d4]
 /usr/bin/mongod(_ZN5mongo13MongoDataFile12openExistingEPKc+0x8c) [0x47aa1c]
 /usr/bin/mongod(_ZN5mongo8Database16openExistingFileEi+0x3a8) [0x2ffa6c]
 /usr/bin/mongod(_ZN5mongo8Database12openAllFilesEv+0x1c) [0x2ffe70]
 /usr/bin/mongod(_ZN5mongo8DatabaseC2EPKcRbRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1d0) [0x300b64]
 /usr/bin/mongod(_ZN5mongo14DatabaseHolder11getOrCreateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_Rb+0x4c8) [0x30132c]
 /usr/bin/mongod(_ZN5mongo6Client7Context11_finishInitEv+0x2c) [0x278030]
 /usr/bin/mongod(_ZN5mongo6Client7ContextC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_b+0x94) [0x278234]
 /usr/bin/mongod(_ZN5mongo14_initAndListenEi+0x988) [0x17a888]
 /usr/bin/mongod(_ZN5mongo13initAndListenEi+0x14) [0x17c740]
 /usr/bin/mongod(main+0x240) [0x15844c]
 /lib/arm-linux-gnueabihf/libc.so.6(__libc_start_main+0x10c) [0x764a6718]
Mon Sep 16 13:55:35.346 [initandlisten] warning database /var/lib/mongodb imoni could not be opened
Mon Sep 16 13:55:35.346 [initandlisten] DBException 13636: file /var/lib/mongodb/imoni.5 open/create failed in createPrivateMap (look in log for more information)
Mon Sep 16 13:55:35.347 [initandlisten] exception in initAndListen: 13636 file /var/lib/mongodb/imoni.5 open/create failed in createPrivateMap (look in log for more information), terminating
Mon Sep 16 13:55:35.347 dbexit:
Mon Sep 16 13:55:35.347 [initandlisten] shutdown: going to close listening sockets...
Mon Sep 16 13:55:35.347 [initandlisten] shutdown: going to flush diaglog...
Mon Sep 16 13:55:35.347 [initandlisten] shutdown: going to close sockets...
Mon Sep 16 13:55:35.348 [initandlisten] shutdown: waiting for fs preallocator...
Mon Sep 16 13:55:35.348 [initandlisten] shutdown: lock for final commit...
Mon Sep 16 13:55:35.348 [initandlisten] shutdown: final commit...
Mon Sep 16 13:55:35.348 [initandlisten] shutdown: closing all files...
Mon Sep 16 13:55:35.348 [initandlisten] closeAllFiles() finished
Mon Sep 16 13:55:35.348 [initandlisten] journalCleanup...
Mon Sep 16 13:55:35.348 [initandlisten] removeJournalFiles
Mon Sep 16 13:55:35.368 [initandlisten] shutdown: removing fs lock...
Mon Sep 16 13:55:35.368 dbexit: really exiting now

Modify mongdb configuration file

sudo nano /etc/mongodb.conf

Modify the setting journal = false, Ctrl + w to save the modification

journal=false

Restart mongodb and start normally~

sudo service mongodb start