简体   繁体   中英

How to restore archive mongoDB database

I have to restore the MongoDB archive tar file (when I extract it shows.wt files inside the tar folder)

tar:      restore-63bbdc996664dc2524cce24d.tar

after extract all files like:    collection-0--423807093138670367.wt

I tried

  • Create a backup of C:\Program Files\MongoDB\Server\5.0\data

  • Place all the.wt files from archive tar in this folder

  • Restart the Mongo server with the windows services.

I also tried

mongorestore --host localhost --port 27017 --db restoredTest C:\Users\rustam\restore-634235

After spending a lot of time on it finally I got the solution

  1. Extract the tar file
  2. Run the below command
mongod --port your_port --dbpath your_extracted_tar_folder

note: port is optional, it will run 27027 default port

  1. Go and connect on the same port that you pass

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM