Home  >  Article  >  Database  >  MongoDB碎片整理之repairDatabase详解

MongoDB碎片整理之repairDatabase详解

WBOY
WBOYOriginal
2016-06-07 16:13:182652browse

比起compact的只整理逻辑碎片.dbrepairDatabase,不仅能整理碎片还可以回收磁盘空间 基本用法: db.repairDatabase() db.runCommand({repairDatabase :1}) 注意点: 1.repairDatabase期间会产生锁,建议关闭应用后再进行此操作 2.repairDatabase所需要的磁盘

比起compact的只整理逻辑碎片.dbrepairDatabase,不仅能整理碎片还可以回收磁盘空间



基本用法:
> db.repairDatabase()
> db.runCommand({repairDatabase :1})


注意点:
1.repairDatabase期间会产生锁,建议关闭应用后再进行此操作
2.repairDatabase所需要的磁盘剩余空间需求很大
3.最后一点,这命令能不用最好别用{过来人的忠告}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn