As explained in the mnemosin answer, logging is important for storage engines. Fortunately, it can be controlled to some extent. The following was written for the MMAPv1 storage engine : this is the default value before MongoDB 3.2. Then WiredTiger became the engine of choice, for which more information can be found at the bottom of this answer.
MMAPv1
MongoDB <2.6 (Non-YAML configuration)
For our development server, we used the following procedure:
cp -p /etc/mongodb.conf /etc/mongodb.conf.orig vi /etc/mongodb.conf
Now insert
smallfiles=true
in mongodb.conf, then save. smallfiles limits the log file to 128 MB.
service mongodb stop rm -rf /var/lib/mongodb/journal
MongoDB> = 2.6 (YAML configuration)
If you use MMAPv1 with the YAML configuration style , use the same step to back up the configuration as above, but in
mmapv1:
configuration block, insert
smallFiles: true
. Subsequently, proceed as described above, restart the server by deleting the logs.
WiredTiger (MongoDB> = 3.0, defaults to 3.2)
On development machines, the log files in WiredTiger are slightly smaller by default than in MMAPv1, because log compression is enabled by default. According to the documentation , "WiredTiger log files for MongoDB have a maximum size of approximately 100 MB." It will "create breakpoints (i.e., write snapshot data to disk) at intervals of 60 seconds or 2 gigabytes of log data."
Thus, if you use only a small number of queries (with a small amount of data to modify) in your database, the log files using WiredTiger should not exceed a minimum of 100 MB. However, the size of the log files is not configurable.
Mitja Aug 26 '14 at 23:48 2014-08-26 23:48
source share