MongoDB数据删除-回收磁盘空间 [英] MongoDB data remove - reclaim diskspace

查看:226
本文介绍了MongoDB数据删除-回收磁盘空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
是否自动压缩mongodb中已删除的空间?

Possible Duplicate:
Auto compact the deleted space in mongodb?

我的理解是,在删除操作上,MongoDB不会释放磁盘空间,但会根据需要重新使用它.

My understanding is that on delete operations MongoDB won't free up the disk space but would reuse it as needed.

  1. 那是正确的吗?
  2. 如果没有,我会运行修复命令吗?
  3. 可以在实时mongo实例上运行修复吗?

推荐答案

  1. 是的,这是正确的.
  2. 不,最好给mongodb尽可能多的磁盘空间(如果mongodb分配的空间多于磁盘碎片少的空间,那么额外的分配空间将是昂贵的操作).但是,如果您愿意,可以从mongodb shell运行db.repairDatabase()来缩小数据库大小.
  3. 是的,您可以在实时mongodb实例上运行repairDatabase(最好在无高峰时间运行它)
  1. Yes it is correct.
  2. No, better to give mongodb as much disk space as possible( if mongodb can allocate more space than less disk fragmentation you will have, in additional allocating space is expensive operation). But if you wish you can run db.repairDatabase() from mongodb shell to shrink database size.
  3. Yes you can run repairDatabase on live mongodb instance ( better to run it in none peak hours)

这篇关于MongoDB数据删除-回收磁盘空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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