Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...