Reputation: 1431
We have a MongoDB cluster with 4 shards. Our primary shard disk space has 700GB, and according to db.stats() that shard is using ~530GB. When checking df -h, the disk usage is on 99% (9.5 GB free), i'm guessing this means that all the rest is data files pre-allocated by Mongo. I've ran compact on couple of collections, and the disk space was reduced to 3.5GB(?)
We're going to run a process that will generate ~140GB of extra data (35GB per shard). Should we have any concerned on running out of disk space?
Thanks in advance.
Upvotes: 0
Views: 4666
Reputation: 2917
compact
doesn't decrease disk usage at all, actually it could even lead to additional file perallocation. To reduce disk usage you could use repairDatabase
command or start mongo with repair option. However, it would require additional free space on disk.
Described situation could be the case if you did a lot of document deletions or some operations that forced documents to move. In this case your database would be highly defragmented. compact
command helps you to reduce defragmentation and you will have more space for new records, but again, it doesn't reclaim any space back to OS.
Best option for you is to try to get why you have such level of defragmentation.
Upvotes: 1