简体   繁体   中英

How to disable mongod journal pre-allocation

Is there a way to prevent mongod from pre-allocating these 100 MB files in journal folder?

WiredTigerPreplog.0000000001 WiredTigerPreplog.0000000002

I want journaling to be enabled.

Find below some notes from MongoDB Documentation for Journaling

WiredTiger will pre-allocate journal files.

Preallocation Lag

MongoDB may preallocate journal files if the mongod process determines that it is more efficient to preallocate journal files than create new journal files as needed.

The preallocation can be avoided using only for MMapv1 storage engine using --noprealloc option when starting the mongod. But this is not applicable for wiredtiger storage engine.

few more references

Meaning of WiredTigerPreplog files

I often need to run test instances of mongod, and these preallocated WiredTiger journal (log) files just waste 200MB each time.

They can disabled by adding this parameter to your mongod command line:

--wiredTigerEngineConfigString 'log=(prealloc=false)'

Or this to your mongod.conf file:

storage:
    wiredTiger:
        engineConfig:
            configString: log=(prealloc=false)

Of course this should never be done in production, and only when testing things that are unrelated to journalling. Journal file preallocation is a deliberate performance feature, which is almost always a win in the real world (and so is why it defaults to true ).

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