Reputation: 41
I want to create prealloc.X files in my journal folder, there is no option to explicitly create these files, it is decided by mongo whether preallocation will be done or not.
I used --journal option but that didin't help.
Please suggest any way or condition where prealloc.X files can be created.
Thanks in advance!
Upvotes: 1
Views: 2095
Reputation: 2153
Preallocation is done by default when journalling is enabled (enabled by default in V2.2 and on). In fact you need to explicitly tell mongo if you want to disable preallocation - using the noprealloc
flag.
I'd suggest you first look if noprealloc
is set to true in your mongodb.conf and change it to false.
But you can also manually create the prealloc.X even before mongod is started so to save the Preallocation Lag. This is described in detail here http://docs.mongodb.org/manual/administration/journaling/#avoid-preallocation-lag
The idea is you start mongod just to cause the prealloc.X files be created. Then you stop it and copy the files to your journal directory of your regular mongd.
Upvotes: 2
Reputation: 43884
MongoDb will actually pre-alloc 2-3GB of journal upon starting mongod
, this as @balafi states is the default behaviour and you must explicitly tell MongoDB not to do this, via --smallfiles
( http://docs.mongodb.org/manual/reference/mongod/#cmdoption-mongod--smallfiles ) and/or --noprealloc
( http://docs.mongodb.org/manual/reference/mongod/#cmdoption-mongod--noprealloc ).
It is normally OK to suffer a bit of pre-allocation lag unless you are in the middle of a production shutdown and every minute = money^2.
So I would recommend checking how you are starting mongod
and see if you have some options which are forcing it to start:
Upvotes: 1