简体   繁体   中英

Unable to start mongod server with default oplog size while trying replication

I was unable to create replication, ie rs.initiate() when oplog was having default value. My server had 400+ GB of space available. In MongoDB's official documentation default range for MMAP is 5% of free disk space between 990MB to 50GB but here under Memory Use :-

With MMAPv1, MongoDB automatically uses all free memory on the machine as its cache.

Error on console while doing rs.initiate() after starting mongod with no oplog size options:

mmap failed with out of memory

"errmsg" : "couldn't initiate : file /data/0/local.7 open/create failed in createPrivateMap (look in log for more information)"

So, I started mongod with --oplogSize 4096 only after which i was able to do rs.initiate. Now I know the issues with small oplog size, but i want to what exactly happened in background. 5% of free disk space or 50 GB upper bound, either way there was still good 300GB available in my server.

You run out of memory!
Yes, mongo will use (eventually) all memory what is available. Problem here is that with 5% rule, creating those local.x database files system required more memory what you had available that point (in time).

With oplogSize parameter you limited oplog to smaller size and that point you had enough memory to create those files.

Parameter --smallfiles (storage.mmapv1.smallFiles) is your friend this case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM