不停机下,mongodb数据库碎片如何整理?
習慣沉默
習慣沉默 2017-05-02 09:22:51
0
1
741

我将mongo里面大量多余的数据都删除后,发现内存和文件并没有收缩,仍然占用大量内存和硬盘,性能变化不大,请问,mongodb怎么进行碎片整理?

習慣沉默
習慣沉默

reply all(1)
洪涛

What version of MongoDB and what engine?
WT engines above 3.2 can use Compact to free up space. Previous versions, whether WT or MMAPv1, could only free up space by resynchronizing the replica set.
The problem is that there is generally no need to release it in a production environment, because it will be occupied sooner or later, and the free space will be reused anyway. If you are not really short of that space, don't release it.
As for whether it is a problem of downtime, it is not just this problem. Most of the time, replica sets should be considered to solve it. Multiple nodes are running in parallel to prepare for no downtime. It will not be a big problem to remove one for maintenance. When you get the main node, it may not be writable for a few seconds.

Theoretically, reclaiming disk space will not have any beneficial impact on performance. However, a bug occurred in the WiredTiger engine used in 3.0.6 and 3.0.7. When a large number of documents were deleted, BTree would have an incorrect balance, resulting in a serious performance degradation. For details, please refer to JIRA Ticket SERVER-21063.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template