MongoDB Replica Set: Difference in disk sizes in primary and secondary nodes

I just installed the mongodb replica config and everything looks good. All data has been correctly moved to secondary nodes. But when I looked at the data directory, I see that the Primary has ~ 140G of data and at the same time the secondary has only ~ 110G.

Has anyone encountered such a problem while setting up a replica set. Is this normal behavior?

+3


source to share


1 answer


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

If you did the repairs on the primary (lock operation, just to do it if absolutely necessary) then they will be much closer.



If you check the output from db.stats()

, you should see that different databases have the same count of objects, the data directory size differences are not a concern.

+6


source







All Articles