I have been using mongodb recently, and I have found out that it is taking a lot of space.
For example, in its db directory /var/lib/mongodb/, if I type "du -sh", then result turns out开发者_高级运维 to be 417M. The thing is that there are only few entries in database, and I do not know how that can take up to 400M of space. Is it normal? or have I done something wrong?
If space is an issue you can start up with a few options so the files aren't pre-allocated larger than your data. This will reduce performance, as then the data won't be contiguous on disk and will require allocation while you are insert/update data. Normally when data is deleted the space will not be released to the filesystem but the space in the allocated files will be reused by mongodb.
See this page for more information: http://www.mongodb.org/display/DOCS/Excessive+Disk+Space
Databases typically expand space automatically but do not return it when no longer needed. This can happen during tests or running queries. Similarly if you have indexes or created aggregates with map-reduce they need to go somewhere next to "your" data.
Special tools must be run manually to reclaim the space. Checkout the repair database functionality.
Run it and see how many is still used after cleaning.
精彩评论