1

I set up a new standalone mongo2.6 and copy one folder(database) from another machine to its data path (because 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 the 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's local file size takes so much more disk space in the secondary, then I need to take this as a spec consideration in the newly bought machine. :(

2
  • Was the data in your MongoDB 2.6 deployment originally created in 2.6, or has it been migrated from an earlier version of MongoDB at some stage? Are you using GridFS? Can you compare database sizes on the two members for significant differences? There are several reasons why replica set members may use different amounts of space for the same data. Longer term you will be better upgrading to a newer and supported version of MongoDB (2.6 end of life was Oct, 2016). You may be able to save significant storage space with the WiredTiger storage engine which includes data & index compression.
    – Stennie
    Commented Feb 10, 2017 at 1:29
  • I copied the local file from am old mongo 2.4 machine to a new empty 2.6 machine as primary first, and then add another empty 2.6 mongo as secondary to auto sync data from the primary. Then the synced data in secondary is larger than that copied on primary.
    – CSJ
    Commented Feb 10, 2017 at 14:27

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.