Mongodb – mongo2.6 local file size on secondary is much larger than primary

mongodb

I set up a new standalone mongo2.6 and copy one folder(database) from another machine to its data path. (cause I enabled directoryperdb)

Then I set up another machine to make them as a replica set.
After rs.initiate and data sync finished, I found the local file size on primary and secondary are:

primary: 232G
secondary: 316G

I found similar question here
https://stackoverflow.com/questions/14843229/mongodb-replica-set-disk-size-difference-in-primary-and-secondary-nodes

But as above answer, the primary should use more disk space than the secondary?

I need to migrate about 25T data from the old mongo 2.6 cluster.
If every database local file size take so more disk space in the secondary, then I need to take this as a spec consideration in the new bought machine 🙁

Best Answer

Your secondary node have more (free) disk space than primary! If you don't specify your oplog size in config file (or command line parameter), mongod will take 5% of free disk space (at dbpath) for opLog.