杰网资源 Design By www.escxy.com

平台有大量的图片已经不用了,数量级达到百万张,差不多100G的空间,放着不管是不是太浪费了?
复制代码 代码如下:
db.fs.files.find({filename:/xxx/}).forEach(function(n) {db.fs.files.update({filename:u.filename},{$set:{filename:newname}},false,true)}} //正则批量更改为固定名称,便于删除。
mongofiles -port 12345 -d xxx delete newname //mongofies根据filename批量干掉这些文件。

db.repairDatabase() //特别注意以上删除不是物理删除,chunks文件实际还在,show dbs 或者 db.stats() 发现db的size没有变化,要执行db.repairDatabase();另外注意这个动作是全局写锁,很耗内存和cpu的,而且处理时间跟文件数量大小有关,务必在非高峰期做。

差不多1个多小时后over, 舒坦了,100G空间啊!!!

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 –repairpath 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.

标签:
Mongodb,批量删除gridfs文件

杰网资源 Design By www.escxy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
杰网资源 Design By www.escxy.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。