HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How to restore .wt backup file to local MongoDB?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
localfilemongodbhowrestorebackup

Problem

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?

Solution

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 


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!

Code Snippets

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

Context

StackExchange Database Administrators Q#204480, answer score: 5

Revisions (0)

No revisions yet.