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.
MongoDB – How to Limit Database Size
limitsmongodb
Related Question
- MongoDB – Should MongoDB 2.6 Be Uninstalled Before Upgrading to 3.0?
- MongoDB Database Design – Schema and Application Design
- Mongodb – Will MongoDB exceed the 64000 ulimit threshold
- MongoDB – How to Keep Database Size Low in MongoDB
- Mongodb – mongo2.6 local file size on secondary is much larger than primary
- PostgreSQL Size Quota on Table or Schema
- MongoDB – How to Limit Server Memory Consumption in MongoDB
- MongoDB Document Size Error – Document Size Larger Than Maximum
Best Answer
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 withmongod -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 = 256MBThis however doesn't stop them from creating another database with the same user. Any help on this?