8

This is a question that was asked before, but I have tried all solutions, and simply cannot get it right. I have spent quite some time researching before posting this question. I have looked at the official MongoDB documents and many other blogs.

How to restore a .wt MongoDB backup file to a local MongoDB database?

0
4

Community wiki answer:

*.wt are binary data files used by the WiredTiger storage engine. Individual files are not usable as a standalone backup. If you want to take a file copy backup of a MongoDB dbPath you need to include all of the files using a Supported File Copy Backup Method.

If you have a valid file backup you can use it as the dbPath for another mongod instance. Aside from copying files, there is no restore special restore process for a file copy backup.

Can you clarify what files you have in your backup?

1
  • 1
    My disk partition has been corrupted, so I don't have dump files. I just have many *.wt files, a journal folder, and a diagnostic.data folder. Is it possible to recover my data from these files? – Kapil Sep 18 '18 at 9:30
2

You can restore your .wt WiredTiger files downloaded from your Atlas Backup (which unzips or untar as a restore folder) to your local MongoDB.

First, make a backup of your /data/db path. Call it /data_20200407/db. Second, copy paste all the .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.

0

There is a much simpler way, But here are few things that need to consider, you can not create a backup from a single .wt file, you have to use the entire folder.

The easiest way is to start mongod with dbpath

mongod --dbpath <path-to-you-backup-folder-where-all-.wt-files-resides>

If your mongod service is already running, you will get some error or the above command will not work. So make sure to stop any existing mongod service if running, and then run the above command. After that simply connect to your localhost mongo server, and this DB will be visible. Hopefully this will works!

1
  • hi I am having same issue I cant able to start service after giving path of database. if you can help me with this, from last two days i am trying to solve this. – Rajesh Gauswami Apr 9 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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