2

Are there any mechanisms to limit the size of a single database on MongoDB 2.6? I found some options like quota, quotaFiles and nssize but am unsure how to use them.

asked Apr 28, 2014 at 12:21
3
  • Are you actually trying to restrict the total size of the database? There are several options to limit individual file sizes, but there is nothing to put a hard limit on how big a database will become. Commented Apr 29, 2014 at 2:10
  • Yes, I was thinking something like that. My team and I wanted to give our students MongoDB environments with limited size because of storage limits at our university. Commented Apr 29, 2014 at 8:29
  • Sorry for spamming, can't edit previous comment. We would like to have around 200 databases (one per user) and each should be limited to lets say 256MB. Commented Apr 29, 2014 at 9:06

3 Answers 3

3

Ok, it was simple :)

I wanted to limit each database to 256MB of space per student. In order to achieve that, I enabled smallfiles in /etc/mongod.conf and ran the mongod process with mongod -f /etc/mongod.conf --quota --quotaFiles 4 which limited the size of the database to 256MB.

smallfiles starts preallocating space with 16MB, then 32MB, 64MB and finally 128MB. Add this up and you get 240MB plus 16MB file for the namespace = 256MB

This however doesn't stop them from creating another database with the same user. Any help on this?

answered Apr 29, 2014 at 11:35
2

Sounds like something for capped collections. Doesn't limit the database itself but does limit the collections?

http://blog.mongodb.org/post/116405435/capped-collections

answered May 6, 2014 at 11:45
0
1

I have the same issue. Mongo does not respect quota. I haven't found the answer, but I found SERVER-5136 . According to this, it is recorded issue but sadly resolution is still not planned.

answered Jun 12, 2014 at 6:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.