Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restore Mongo(WT engine) only with collection-0-****.wt file?

Tags:

mongodb

My mongodb can't lanuch now, when I want start mongo got error ***aborting after invariant() failure

Now I want to restore collection-0-****.wt file to a new db, is this possible?

like image 737
diggzhang Avatar asked May 31 '16 23:05

diggzhang


People also ask

How restore wt file in MongoDB?

wt files from your Atlas Backup restore folder into your local /data/db path . Restart your Ubuntu or MongoDB server. Start your Mongo shell and you should have those restored files there.

How do I restore a collection in MongoDB?

Run the MongoDB system command ps -ef | grep mongod to find the temporary recovery MongoDB instance location. Run the MongoDB mongodump command to create a dump file of any specific database or collection. Run the mongorestore command to restore the dump file into any MongoDB instance.

What is wt file in MongoDB?

wt files contain the data of the MongoDB collections and indexes that you observe as a client connected to a MongoDB instance. Once you've identified the WT ident value for the collection or index you want to inspect you can use that in the URI argument to the wt dump command.

How do I read a .WT file?

How do you open WT files? You need a suitable software like WildTangent to open a WT file. Without proper software you will receive a Windows message "How do you want to open this file?" or "Windows cannot open this file" or a similar Mac/iPhone/Android alert.


1 Answers

As at MongoDB 3.2, only full backups of WiredTiger data directories can be copied into a new instance. WiredTiger collection or index files aren't self-contained; they rely on other metadata in the WiredTiger.* catalog files. The invariant/assertion you are getting on startup is expected if data files are incomplete or inconsistent.

If you want to backup and restore a single collection, you should use mongodump and mongorestore, eg:

 mongodump --db test --collection northwind --host host1

 mongorestore --db test dump/test/northwind.bson --host host2

For supported full backup procedures, see: MongoDB Backup Methods.

like image 95
Stennie Avatar answered Oct 11 '22 00:10

Stennie