14

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

3 Answers 3

5

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. Apr 9, 2021 at 9:44
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
  • 3
    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, 2018 at 9:30
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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