开发者

How to reduce MongoDB storage space after deleting a large amount of data [duplicate]

开发者 https://www.devze.com 2023-03-08 15:25 出处:网络
This quest开发者_StackOverflow中文版ion already has answers here: Reducing MongoDB database file size
This quest开发者_StackOverflow中文版ion already has answers here: Reducing MongoDB database file size (16 answers) Closed 5 years ago.

I have a database in MongoDB, called dump. Currently, it reached 6GB in my server. I decided to delete 90% of data in this database to reduce the disk space it occupied. But after doing that its size is still 6GB, while the true storage size is only 250MB.

I guess this is the design of MongoDB? Is there any convinient way to reduce its size? Thank in advance.


Try (source):

$ mongo mydb
> db.repairDatabase()


To compress the data files, you can run either start up MongoDB with mongod --repair, or connect to the database through the shell and run db.repairDatabase().

There's also a new compact command scheduled for v1.9 that will do in-place compaction.

0

精彩评论

暂无评论...
验证码 换一张
取 消