时间:2021-05-28 08:00:57 | 栏目:mongodb | 点击:次
平台有大量的图片已经不用了,数量级达到百万张,差不多100G的空间,放着不管是不是太浪费了?
db.repairDatabase() //特别注意以上删除不是物理删除,chunks文件实际还在,show dbs 或者 db.stats() 发现db的size没有变化,要执行db.repairDatabase();另外注意这个动作是全局写锁,很耗内存和cpu的,而且处理时间跟文件数量大小有关,务必在非高峰期做。
Be aware that this command can take a long time to run if your database is large. In addition, it requires a quantity of free disk space equal to the size of your database. If you lack sufficient free space on the same volume, you can mount a separate volume and use that for the repair. In this case, you must run the command line and use the ?Crepairpath switch to specify the folder in which to store the temporary repair files.
Warning:This command obtains a global write lock and will block other operations until it has completed.