如何在没有`db.repairDatabase()`的情况下回收已删除的空间? [英] How to reclaiming deleted space without `db.repairDatabase()`?

查看:140
本文介绍了如何在没有`db.repairDatabase()`的情况下回收已删除的空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过回收已删除的空间来缩小数据文件的大小,但是我无法运行db.repairDatabase(),因为可用磁盘空间不足.

I want to shrink data files size by reclaiming deleted space, but I can't run db.repairDatabase(), because free disk space is not enough.

推荐答案

更新:使用WiredTiger,

Update: With WiredTiger, compact does free space.

这个问题的原始答案在这里: 减小MongoDB数据库文件的大小

The original answer to this question is here: Reducing MongoDB database file size

repair之外确实没有其他东西可以回收空间. compact应该可以让您在现有空间上走得更远.否则,您将不得不迁移到更大的驱动器.

There really is nothing outside of repair that will reclaim space. The compact should allow you to go much longer on the existing space. Otherwise, you will have to migrate to a bigger drive.

执行此操作的一种方法是使用副本集中的离线辅助副本.这应该为您提供一个完整的维护窗口,以进行迁移,修复,后退和恢复.

One way to do this is to use an off-line secondary from your Replica Set. This should give you a whole maintenance window to migrate, repair, move back and bring back up.

如果您没有运行副本集,那么该是考虑这样做的时候了.

If you are not running a Replica Set, it's time to look at doing just that.

这篇关于如何在没有`db.repairDatabase()`的情况下回收已删除的空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆