MongoDB 副本集:主节点和辅助节点的磁盘大小差异 [英] MongoDB Replica Set: Disk size difference in Primary and Secondary Nodes

查看:100
本文介绍了MongoDB 副本集:主节点和辅助节点的磁盘大小差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚做了 mongodb 副本集配置,一切看起来都不错.所有数据正确移动到辅助节点.但是当我查看数据目录时,我可以看到 Primary 有 ~140G 的数据,而同时 Secondary 只有 ~110G.

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?

推荐答案

当您在辅助服务器上从头开始进行初始同步时,它会重新写入所有数据.这会删除填充、空白空间(删除的数据)等.因此,在这方面,它类似于运行修复.

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.

如果您检查 db.stats() 的输出,您应该看到各个数据库具有相同的对象计数,数据目录大小差异无需担心.

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.

这篇关于MongoDB 副本集:主节点和辅助节点的磁盘大小差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆