Set MongoDB Database quota (SIZE)
Asked Answered
D

2

7

I want to allow my shared hosting sites to use MongoDB, however as they are all on the same VPS server I am able to get mongo to create databases, and asign them to users but I seem not to be able to limit the size of the database only the size of the collection. Which can be changed.

Is there away as an admin to limit the size of the database.

Divestiture answered 20/3, 2012 at 0:32 Comment(0)
E
12

MongoDB allocates database chunks, starting at 64MB (dbname.0), followed by 128MB (.1), 256, etc. up to 2GB, then each file is 2GB from there on out.

If you use --smallfiles in the mongod.exe commandline params, file allocation begins at 16MB instead of 64MB, and maxes out at 512MB instead of 2GB.

Combine this with --quotaFiles 1, and your database can't grow beyond one file, or... 16MB. I always use --quotaFiles in conjunction with --quota, per the help docs.

Endpaper answered 3/4, 2012 at 21:40 Comment(0)
P
-1

I dont believe this can be done with MongoDB. If at all possible, you might want to create volumes on your server that have quota's set on them, and spin up multiple instances of mongod

You should keep in mind, however, that MongoDB attempts to keep as much data as possible in memory. This could pose performance issues for customers when their data gets swapped to disk in exchange for someone else's data.

Potbellied answered 20/3, 2012 at 0:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.