Hi Guys,
Kindly help me with mongodump and restore, we have running mongodb setup and we have planning to move our db setup on cloud.
I have successfully backdup my db using the following.
Where is have configured mongodb (Centos 7 and Mongodb 3.2.9).
Now the issues starts while restoring my db, I have not received any error but it is not complete, I mean mongorestore is not restoring my complete db. I used the following command to restore.
I tried restoring with index and without indexing.
Kindly help
Kindly help me restoring complete db on my new VM centOS 7 and Mongodb 3.2.9.
Thanks,
Gulab
mongorestore --db database_name path_to_bson_fileexample:
>mongorestore --db shah H:\quiz.json\quiz
i have imported quiz database into new shah database..
worked successfully.. hope it will be useful....
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/86f63c8c-2ef8-4994-aea2-76bbc3f720a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
mongorestore --db database_name db_dump_path (this is not worked)mongorestore --db database_name path_to_bson_fileexample:>mongorestore --db shah H:\quiz.json\quizi have imported quiz database into new shah database..worked successfully.. hope it will be useful....
On Sun, Sep 25, 2016 at 4:12 PM, Gulab Pasha <gulab...@gmail.com> wrote:
Hey Guys,
Kindly help me restoring complete db on my new VM centOS 7 and Mongodb 3.2.9.
Thanks,
Gulab
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
Hi,
I tried to restore db using the following but still the same, it is not restoring complete db, I see there is no error while restoring but out 54gb it is restoring only 11gb data.
mongorestore should be able to restore the whole database. Could you please provide more details:
mongodump correctly dumped the whole database?The more detailed information you can give regarding your setup and the actual sequence of events, the more likely we could help you.
mongorestore —db database_name db_dump_path (this is not worked)
Could you please try running mongorestore with the -v flag? Note that you can pass multiple v e.g. -vvvv to increase the logging verbosity. Hopefully the increased logging verbosity will show some hint of the cause.
You could also check the mongodump page and the mongorestore page to see if there are any parameters that may be missed.
Best regards,
Kevin
mongodump correctly dumped the whole database?Hi,
Output of mongodump and mongorestore doesn’t show any error. However, data size is not a reliable metric when judging if two MongoDB deployments have the same content due to fragmentation, storage engine differences, etc.
Both are Standalone Nodes.
What about their storage engine? Are both of them using WiredTiger, MMAPv1? Are the output of db.serverCmdLineOpts() of both servers identical?
Yes - I believe DB is missing all the necessary documents and users
How did you find out that there are missing documents in the restored database? Is your application giving errors?
A couple of things you could check:
Run db.stats() on the source server and the restored server. The output should look like the following:
> db.stats()
{
"db": "test",
"collections": 12,
"objects": 10305,
"avgObjSize": 149.719941775837,
"dataSize": 1542864,
"storageSize": 872448,
"numExtents": 0,
"indexes": 17,
"indexSize": 774144,
"ok": 1
}
Of particular interest is the collections and objects numbers, which will tell you the total number of documents that are present in the source and restored databases.
Run db.<collection>.stats() on each collection. This command will have a similar number (i.e. document count) that you can compare on both source and restored databases.
Please note that the stats() numbers could be inaccurate if there was ever an unexpected shutdown (see https://docs.mongodb.com/v3.2/reference/method/db.collection.stats/#unexpected-shutdown-and-count). To ensure you have an accurate count, you can run db.<collection>.validate() on each collection.
Best regards,
Kevin
Hi,
Sorry, a small clarification for this sentence in my previous post:
However, data size is not a reliable metric when judging if two MongoDB deployments have the same content
I actually meant storage size (i.e. storageSize from the db.stats() output, which is the amount of disk space used) instead of data size (i.e. dataSize, which is the size of the actual data)
The output of show dbs shows the storage size on disk instead of the actual data size. Those values are the same values from the output of db.adminCommand({listDatabases:1}).
One possibility for the storage size discrepancy that you’re seeing is that mongodump were done on a MongoDB running the MMAPv1 storage engine, and mongorestore were done to a WiredTiger storage engine. The WiredTiger storage engine uses compression by default, which frequently results in a storage size (disk usage) that is smaller compared to MMAPv1 for the same data.
Best regards,
Kevin
Hi Gulab,
I have tried to restore my DB in CentOS 7 and Ubunut 16.04LTS and I have install MongoDB 3.2.10 on both the flavors. In both “Linux flavor VM’s mongo 3.2.10” mongorestore is seems to be successful with Indexing but DB size seems to be very very less. However I have prepared one more VM with CentOS 7 and installed MongoDB 2.6.
In CentOS 7 MongoDB 2.6 I was unable to restore DB with Indexes, I have restored DB without indexes but the outcome is some what satisfactory.
What I can gather from your screenshots are:
dataFileVersion field), and “Ubuntu16” is using WiredTiger (from the lack of dataFileVersion field). See https://docs.mongodb.com/manual/reference/command/dbStats/#dbStats.dataFileVersion.Some things you could try to determine what happened:
mongorestore using the -vvvvv option (see https://docs.mongodb.com/manual/reference/program/mongorestore/#cmdoption--verbose)--stopOnError option to halt import when an error is encountered (see https://docs.mongodb.com/manual/reference/program/mongorestore/#cmdoption--stopOnError)show collections between the three servers to find out what collections is not present in the restored deployment. Note that you can restore individual collection by running mongorestore --db <database> --collection <collection> <dump directory>/<database>/<collection>.bson (see https://docs.mongodb.com/manual/reference/program/mongorestore/#restore-a-collection)mongodump was run?Best regards,
Kevin