0

I am supposed to restore a big mongo database on another system. I have a folder with about 12500 ".wt" files and some other files. I tried to use mongorestore:

mongorestore --uri mongodb://localhost:27017 /mongoBackupfiles

but for each file, the error is something like this:

don't know what to do with file "...\index-2215-3057564938218478932.wt", skipping...

I searched a lot but still couldn't find anything that help. I tried to restore the database on Windows and Linux Redhat but didn't get anything.

MohoTa
  • 27
  • 1
  • 1
  • 9
  • What do you have in `/mongoBackupfiles`? You can use `mongorestore` only for files which have been created previously by `mongodump`. If you want to restore the `.wt` files, then you can simply copy all files to new location. Note, the MongoDB must be stopped and you must copy **all** files/folders from `dbPath` not just `*.wt` files. – Wernfried Domscheit May 11 '23 at 06:17
  • @WernfriedDomscheit Thanks, I will do as you said. I see lots of files in this folder. Most of them are like this "collection-0--892110962278290531.wt" and "index-1--892110962278290531.wt". Also several WiredTiger with different types like ".wt" ".turtle" and "storage.bson" "sizeStorer.wt" "mongod.lock" – MohoTa May 11 '23 at 13:24
  • I copied everything in the dbpath (it is in C:\Program Files\MongoDB\Server\4.4\data). After restarting, the Mongodb Compass couldn't connect to the server with this error: ""connect ECONNREFUSED 127.0.0.1:27017"" On Terminal in c:\Program Files\MongoDB\Server\4.4\bin> I executed "mongod --repair" and then "mongod". The Mongo service started on the terminal. At that time the Mongodb Compass connected to service. But no database appeared. – MohoTa May 11 '23 at 14:50
  • How did you start the MongoDB? I assume you don't use the new path, see https://stackoverflow.com/a/67043090/3027266 – Wernfried Domscheit May 11 '23 at 15:07
  • Thanks. So this time I copied all the files in the c:\data\db. At first the error was permission denied, so I deleted the WiredTiger.lock and mongod.lock. then, I used --repair and restarted the Mongod. it still does not show databases but the service is working – MohoTa May 11 '23 at 15:51
  • I start the Mongo with this line: 'mongod --dbpath c:\data\db' – MohoTa May 11 '23 at 15:59

0 Answers0