Mongo dump and restore shows drastically different db.stats()

107 views
Skip to first unread message

Jazzed

unread,
Oct 26, 2016, 1:21:17 PM10/26/16
to mongodb-user

I run a mongodump of our database every night.

When I did a restore to a totally separate replica set the sizes are drastically different. I'm gathering that this is probably normal, but looking for a little more confirmation from the community.


First is the current prod db stats, then the next section is the replica set I created and performed a mongorestore.  showdbs shows the db at about 140GB, yet the mongodump size is about 80GB.


Thanks for any comments.

:PRIMARY> db.stats()
{
 
"db" : "mydb",
 
"collections" : 96,
 
"objects" : 40182457,
 
"avgObjSize" : 2842.668457730198,
 
"dataSize" : 114225403068,
 
"storageSize" : 138906960176,
 
"numExtents" : 671,
 
"indexes" : 170,
 
"indexSize" : 8715763168,
 
"fileSize" : 153453592576,
 
"nsSizeMB" : 16,
 
"dataFileVersion" : {
 
"major" : 4,
 
"minor" : 5
 
},
 
"extentFreeList" : {
 
"num" : 13,
 
"totalSize" : 847515648
 
},
 
"ok" : 1
}


other:PRIMARY> db.stats()
{
"db" : "mydb",
"collections" : 95,
"objects" : 21998977,
"avgObjSize" : 3164.537482629306,
"dataSize" : 69616587296,
"storageSize" : 82682279888,
"numExtents" : 556,
"indexes" : 170,
"indexSize" : 4739063056,
"fileSize" : 89060540416,
"nsSizeMB" : 16,
"dataFileVersion" : {
"major" : 4,
"minor" : 5
},
"extentFreeList" : {
"num" : 0,
"totalSize" : 0
},
"ok" : 1
}


Kevin Adistambha

unread,
Nov 4, 2016, 12:49:48 AM11/4/16
to mongodb-user

Hi,

Looks like there is something missing. Here’s the number of collections and objects in the Prod database:

“collections” : 96,
“objects” : 40182457,
“dataSize” : 114225403068,

and here’s the numbers in the restored database:

“collections” : 95,
“objects” : 21998977,
“dataSize” : 69616587296,

There seems to be a missing collection, along with 18,183,480 documents, the size of which is 44,608,815,772 bytes.

Note that since apparently MMAPv1 is the storage engine used, the storageSize number cannot be compared, since the MMAPv1 files could contain fragmentations if documents are deleted or modified.

Are you using mongodump and mongorestore? Could you post:

  • Your MongoDB version.
  • The exact command line parameters you used to perform the dump and the restore.
  • Any error message during dump or restore, either in the console or in the logs?
  • Are you certain that the dump job completed successfully?

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages