MongoDB Replica Set: Disk size difference in Primary and Secondary Nodes

安稳与你 提交于 2019-12-07 02:49:00

问题


I just did the mongodb replica set configuration and all looks good. All data moved to secondary nodes properly. But when I looked at the data directory, I can see Primary have ~140G of data and at the same time secondary has only ~110G.

Did anyone come across this kind of issue while setting up the Replica Set. Is that something normal behavior?


回答1:


When you do an initial sync from scratch on a secondary, it writes all the data fresh. This removes padding, empty space (deleted data) etc. As a result, in that respect it is similar to running a repair.

If you ran a repair on the primary (blocking operation, only to be done if absolutely necessary), then the two would be far closer overall.

If you check the output from db.stats() you should see that the various databases have the same object count, the data directory size differences are nothing to be worried about.



来源:https://stackoverflow.com/questions/14843229/mongodb-replica-set-disk-size-difference-in-primary-and-secondary-nodes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!