This is related to my question in stackoverflow where vb.net simply hang on updating a mongodb query.
https://stackoverflow.com/questions/12780258/insert-mongodb-using-vb-net/12796593#12796593
After long soul searching we check the log. The log is 3GB in size.
A log with that size is absolutely useless. I cannot have any text editor to open it.
How to keep the log of mongodb small, say 50 mb max.
We are only interested in the last few commmand anyway not the whole log.
Is there a setting for that in MongoDB? If so what settings:
Note: The question is simmilar with:
https://stackoverflow.com/questions/8777449/mongodb-log-file-size
However, that question doesn't ask
How do I do so by changing some text files or something persistent so that the setting remain every time I start mongodb.
Best Answer
You might already know the answer just posting the answer here for someone else like me ending in this post :D
This would set smallfiles true once you restart your mongodb.
UPDATE:
Rounding a little bit more the answer
smallfiles
option in mongo what does is reducing the initial and journal data files size, this is useful if your machine do not have to much space or if you are gonna have multiple databases with small data each.I my personal opinion
smallfiles
do not increase performance but like mentioned before could help for this specific scenarios another example is with Docker if you are not using-v "path/to/local/drive:"/data/db"
then is better to setsmallfiles
true in my case if i don't the container breaks because it can't allocate the default data file space.To add
smallfiles
to the mongo.conf you can do:More detailed info here: http://docs.mongodb.org/manual/reference/configuration-options/#storage.mmapv1.smallFiles
Hope this helps :D
Important UPDATE: Starting in version 4.2, MongoDB removed
smallfiles
option.More details at: https://docs.mongodb.com/manual/reference/program/mongos/#bin.mongos
So for latest available options, check the updated manual at: https://docs.mongodb.com/manual/tutorial/rotate-log-files/