Re: how to check whether mongo restore is success

431 views
Skip to first unread message

Asya Kamsky

unread,
May 3, 2013, 11:10:33 PM5/3/13
to mongod...@googlegroups.com
When did you take db.stats() on the server?  Was it before you started the dump?  Depending on how long the dump took, changes probably did happen there.


On Friday, May 3, 2013 7:03:55 PM UTC-7, Shen John wrote:
I am try to dump an database from my server to local machine. There is no error while restore. I want to check whether restore database is success. 
I run the command "db.stats()" from my server and local machine, here is the screenshot: 
my server,


local machine:

















By the way there is "system.profile" collection in my server which has 2027 records, So I calculate the objects: 50893724-2027 (my server objects) != 50892878 (local objects). 
Finally i am sure that the database is not change during dump it.
It is so confuse to me. Is there something wrong?  Need your help :(

Shen John

unread,
May 5, 2013, 7:29:05 AM5/5/13
to mongod...@googlegroups.com
Thanks Asya. I  run "db.stats() " after restore success. And I am very sure that there is no changes.

在 2013年5月4日星期六UTC+8上午11时10分33秒,Asya Kamsky写道:

Asya Kamsky

unread,
May 5, 2013, 12:36:53 PM5/5/13
to mongod...@googlegroups.com
If you run it after the restore on the original DB then it's *possible* that there were changes, right?  (Unless this was on your laptop that on one else connects to :) ).

Here is what you can do next to try to figure out *what* the differences are (we can't really figure out the "why" until we know the "what").

In the original server and in your restored copy run this command on the database in question:
> db.db.printCollectionStats()

This will print this sort of output for each collection in the DB:

out
{
"ns" : "new.out",
"count" : 10,
"size" : 360,
"avgObjSize" : 36,
"storageSize" : 8192,
"numExtents" : 1,
"nindexes" : 1,
"lastExtentSize" : 8192,
"paddingFactor" : 1,
"systemFlags" : 1,
"userFlags" : 0,
"totalIndexSize" : 8176,
"indexSizes" : {
"_id_" : 8176
},
"ok" : 1
}

You can compare collection by collection and when you find mis-matches jot them down then we can try to figure out how they came about.

Asya
P.S. if you are going to try to duplicate the problem, I would recommend doing db.stats() on the original server BEFORE doing the dump.
Then do the dump, restore and do db.stats() in the restored database.
Message has been deleted

Shen John

unread,
May 10, 2013, 1:35:45 AM5/10/13
to mongod...@googlegroups.com
I will do what you recommend. Thanks

在 2013年5月6日星期一UTC+8上午12时36分53秒,Asya Kamsky写道:
Reply all
Reply to author
Forward
0 new messages