Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

mongodb - 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

[[email protected] 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 ??

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...