在mongoDB中刪除數(shù)據(jù)并不會直接釋放磁盤怪嫌,而是產(chǎn)生很多碎片扑毡,這些碎片會被mongoDB繼續(xù)利用有送。
清理數(shù)據(jù)之后淌喻,當(dāng)有新的數(shù)據(jù)進來之后,會將數(shù)據(jù)分配到該數(shù)據(jù)文件中雀摘,不會占用額外的空間裸删,在mongDB看來空間已經(jīng)釋放了,只是從系統(tǒng)層面看空間沒有釋放阵赠。
當(dāng)有新數(shù)據(jù)插入時涯塔,會重復(fù)利用這些碎片,而不需要新申請磁盤空間清蚀。但是這會導(dǎo)致的問題是匕荸,磁盤可能一直處于高水位的使用水平。
對運維來說是一個定時炸彈轧铁,因為碎片只會被所屬的庫使用每聪,但我們經(jīng)常會新建很多庫,這就導(dǎo)致磁盤越來越緊張齿风。
MongoDB 磁盤清理那些事兒
https://xie.infoq.cn/article/d8cb871a7733646996f60641a
Monodb刪除數(shù)據(jù)和磁盤空間釋放
https://www.homedt.net/98775.html
Understanding and Managing Disk Space on your MongoDB Server
https://scalegrid.io/blog/understanding-managing-disk-space-on-your-mongodb-server
Reclaiming Disk Space From MongoDB
https://dzone.com/articles/reclaiming-disk-space-from-mongodb