简体   繁体   中英

Setting smallfiles option for controlling journaling doesn't control the size

I am using mongodb 2.0 for my development environemnt . i am starting mongodb with the following below configuration through a config file .

replSet = ubsc
fork    = true
port    = 27017
dbpath  = /data/mongodb
logpath = /data/mongodb/mongodb.log
rest = true
smallfiles = true

My question is that even though i am setting the option of generating smallfiles for the journaling through setting (smallfiles = true ) in my config file .

I accessed the application only for 5 minutes , (5-10 minutes ) , the file inside the journal folder has grown to a huge size

[mark_user@ubsdvf.oitreo.com journal]$  ls -lrt
total 393632
-rw------- 1 s606970 s606970 134217728 Oct 21 07:41 prealloc.1
-rw------- 1 s606970 s606970 134217728 Oct 21 07:46 prealloc.2
-rw------- 1 s606970 s606970        88 Oct 21 08:42 lsn
-rw------- 1 s606970 s606970 134217728 Oct 21 08:42 j._0

Please let me know why the file has grown to a huge size ??

Once you restart mongodb server after enabling smallfiles , it will be applied only for new databases. Any existing database will not be affected by this configuration.

Test this configuration by creating a new database.

Also, it is mentioned in the documentation that enabling this configuration will affect the performance.

The smallfiles setting can lead mongod to create many files, which may affect performance for larger databases.

So use it cautiously

I accessed the application only for 5 minutes , (5-10 minutes ) , the file inside the journal folder has grown to a huge size

Well, the file is not that huge (not in the sense of mongodb anyway). Once you enable smallfiles, the journal files size is set to 128MB (exactly 134217728 bytes) instead of 1GB, which is the default.

So it's not as it has grown so huge. This is the default (pre-allocated) journal file, when using smallfiles option.

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