Mongodb – How to restore Mongo DB tar.gz archive

mongo-repairmongodbmongorestore

Using the Mongo DB Atlas cloud service (MongoDB Version: 3.4.16), the below backup archive of a MongDB was generated:

Cluster0-shard-0-1531635127-5b4b0df33b34b92b0f50a045.tar.gz

In this file I can see the collections:

collections-0--****.wt

How can this DB be fully restored on a local instance of MongoDB?

Local MongoDB version is 3.4.16

Edit:
Thanks for pointing to editing dbPath config, I was now able to make some progress by putting the files in C:\data\db and downgrading to 3.4. (Although I would rather have the files on the D: drive). Unfortunately now the new error with mongod.exe is:

C:\Program Files\MongoDB\Server\3.4\bin    mongod
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] MongoDB starting : pid=16920 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-3SH9864
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] db version v3.4.16
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] git version: 0d6a9242c11b99ddadcfb6e86a850b6ba487530a
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2o-fips  27 Mar 2018
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] allocator: tcmalloc
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] modules: none
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] build environment:
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten]     distarch: x86_64
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten]     target_arch: x86_64
2018-09-03T11:01:16.380-0700 I CONTROL  [initandlisten] options: {}
2018-09-03T11:01:16.381-0700 I -        [initandlisten] Detected data files in C:\data\db\ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-09-03T11:01:16.381-0700 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=7615M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),verbose=(recovery_progress),
2018-09-03T11:01:16.395-0700 E STORAGE  [initandlisten] WiredTiger error (-31802) [1535997676:395795][16920:140715718360144], txn-recover: unsupported WiredTiger file version: this build  only supports major/minor versions up to 1/0,  and the file is version 3/0: WT_ERROR: non-specific WiredTiger error
2018-09-03T11:01:16.395-0700 E STORAGE  [initandlisten] WiredTiger error (0) [1535997676:395795][16920:140715718360144], txn-recover: WiredTiger is unable to read the recovery log.
2018-09-03T11:01:16.396-0700 E STORAGE  [initandlisten] WiredTiger error (0) [1535997676:395795][16920:140715718360144], txn-recover: This may be due to the log files being encrypted, being from an older version or due to corruption on disk
2018-09-03T11:01:16.396-0700 E STORAGE  [initandlisten] WiredTiger error (0) [1535997676:395795][16920:140715718360144], txn-recover: You should confirm that you have opened the database with the correct options including all encryption and compression options
2018-09-03T11:01:16.396-0700 E STORAGE  [initandlisten] WiredTiger error (-31802) [1535997676:395795][16920:140715718360144], txn-recover: Recovery failed: WT_ERROR: non-specific WiredTiger error
2018-09-03T11:01:16.398-0700 I -        [initandlisten] Assertion: 28595:-31802: WT_ERROR: non-specific WiredTiger error src\mongo\db\storage\wiredtiger\wiredtiger_kv_engine.cpp 277
2018-09-03T11:01:16.399-0700 I STORAGE  [initandlisten] exception in initAndListen: 28595 -31802: WT_ERROR: non-specific WiredTiger error, terminating
2018-09-03T11:01:16.399-0700 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2018-09-03T11:01:16.399-0700 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2018-09-03T11:01:16.399-0700 I CONTROL  [initandlisten] now exiting
2018-09-03T11:01:16.399-0700 I CONTROL  [initandlisten] shutting down with code:100

with mongo.exe the error is different:

C:\Program Files\MongoDB\Server\3.4\bin> mongo
MongoDB shell version v3.4.16
connecting to: mongodb://127.0.0.1:27017
2018-09-03T19:02:26.926+0100 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2018-09-03T19:02:26.926+0100 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:240:13
@(connect):1:6
exception: connect failed

Edit: added MongoDB version of backup file as found in restoreinfo.txt

Best Answer

The solution was to delete the below files in data folder:

  • delete folder: data/db/journal
  • delete file: mongod.lock
  • delete file WiredTiger.lock

After doing this, I could start mongod without any issues.