真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

【MongoDB】查看數(shù)據(jù)庫(kù)集合的占用空間,清理集合的冗存空

到庫(kù)下面查看占用空間

tables = db.getCollectionNames();
tables.forEach( function (item) { 
    stats=db.runCommand({collStats:item});
    sizeGB = stats.storageSize/1024/1024/1024;
    prettyGB = Math.round(sizeGB)+ 'GB';
    print(item, prettyGB)
})

清理冗余空間

// primary
db.runCommand({compact:'flow_down_stream_info',force:true})
// secondary
db.runCommand({compact:'flow_down_stream_info'})

建議先在從庫(kù)上運(yùn)行,觀察沒(méi)問(wèn)題后再在primary上運(yùn)行

創(chuàng)新互聯(lián)主要為客戶提供服務(wù)項(xiàng)目涵蓋了網(wǎng)頁(yè)視覺(jué)設(shè)計(jì)、VI標(biāo)志設(shè)計(jì)、營(yíng)銷推廣、網(wǎng)站程序開(kāi)發(fā)、HTML5響應(yīng)式重慶網(wǎng)站建設(shè)、手機(jī)網(wǎng)站制作設(shè)計(jì)、微商城、網(wǎng)站托管及網(wǎng)站維護(hù)、WEB系統(tǒng)開(kāi)發(fā)、域名注冊(cè)、國(guó)內(nèi)外服務(wù)器租用、視頻、平面設(shè)計(jì)、SEO優(yōu)化排名。設(shè)計(jì)、前端、后端三個(gè)建站步驟的完善服務(wù)體系。一人跟蹤測(cè)試的建站服務(wù)標(biāo)準(zhǔn)。已經(jīng)為成都陽(yáng)臺(tái)護(hù)欄行業(yè)客戶提供了網(wǎng)站開(kāi)發(fā)服務(wù)。

不建議使用repairDatabase()命令

有可能造成數(shù)據(jù)損壞

Just to clarify, please be careful about using repairDatabase on a replica set node. repairDatabase is meant to be used to salvage readable data i.e. after a disk corruption, so it can remove unreadable data and let MongoDB start in the face of disk corruption.

If this node has an undetected disk corruption and you run repairDatabase on it, this could lead into that particular node having a different data content vs. the other node as a result of repairDatabase. Since MongoDB assumes all nodes in a replica set contains identical data, this could lead to crashes and hard to diagnose problems. Due to its nature, this issue could stay dormant for a long time, and suddenly manifest itself with a vengeance, seemingly without any apparent reason.

WiredTiger will eventually reuse the empty spaces with new data, and the periodic checkpointing that WiredTiger does could potentially release space to the OS without any intervention on your part.

If you really need to give space back to the OS, then an initial sync is the safest choice if you have a replica set. On a standalone, dump/restore will achieve the same result. Otherwise, compact is the safer choice vs. repairDatabase. Please backup your data before doing any of these, since in my opinion this would qualify as a major maintenance

MongoDB / WiredTiger: reduce storage size after deleting properties from documents

另外

repairDatabase命令對(duì)GridFS的庫(kù)不起作用


當(dāng)前標(biāo)題:【MongoDB】查看數(shù)據(jù)庫(kù)集合的占用空間,清理集合的冗存空
瀏覽地址:http://weahome.cn/article/jjochh.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部