0

My developer accidentally lost our database by a bash script, which turned out to run rm -rf /* (see this thread). Thanks to extundelete, he just recovered the /data/db/ folder:

enter image description here

However, he could not successfully load the database in Robo 3T; it looks quite empty here:

enter image description here

Here is the result of running mongod --port 27017 --dbpath /data/db --bind_ip_all --repair:

I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
I CONTROL  [initandlisten] MongoDB starting : pid=23018 port=27017 dbpath=/data/db 64-bit host=iZj6c0pipuxk17pb7pbaw0Z
I CONTROL  [initandlisten] db version v4.0.7
I CONTROL  [initandlisten] git version: 1b82c812a9c0bbf6dc79d5400de9ea99e6ffa025
I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
I CONTROL  [initandlisten] allocator: tcmalloc
I CONTROL  [initandlisten] modules: none
I CONTROL  [initandlisten] build environment:
I CONTROL  [initandlisten]     distmod: ubuntu1604
I CONTROL  [initandlisten]     distarch: x86_64
I CONTROL  [initandlisten]     target_arch: x86_64
I CONTROL  [initandlisten] options: { net: { bindIpAll: true, port: 27017 }, repair: true, storage: { dbPath: "/data/db" } }
W STORAGE  [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
I STORAGE  [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
W STORAGE  [initandlisten] Recovering data from the last clean checkpoint.
I STORAGE  [initandlisten]
I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=256M,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),statistics_log=(wait=0),verbose=(recovery_progress),
E STORAGE  [initandlisten] WiredTiger error (17) [1553494202:818725][23018:0x7f6119074a40], connection: __posix_open_file, 715: /data/db/WiredTiger.wt: handle-open: open: File exists Raw: [1553494202:818725][23018:0x7f6119074a40], connection: __posix_open_file, 715: /data/db/WiredTiger.wt: handle-open: open: File exists
I STORAGE  [initandlisten] WiredTiger message unexpected file WiredTiger.wt found, renamed to WiredTiger.wt.1
I STORAGE  [initandlisten] WiredTiger message [1553494203:832267][23018:0x7f6119074a40], txn-recover: Main recovery loop: starting at 4/11366912 to 5/256
I STORAGE  [initandlisten] WiredTiger message [1553494203:832674][23018:0x7f6119074a40], txn-recover: Recovering log 4 through 5
I STORAGE  [initandlisten] WiredTiger message [1553494203:898252][23018:0x7f6119074a40], txn-recover: Recovering log 5 through 5
I STORAGE  [initandlisten] WiredTiger message [1553494203:964880][23018:0x7f6119074a40], txn-recover: Set global recovery timestamp: 0
I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
E STORAGE  [initandlisten] WiredTiger error (17) [1553494203:999855][23018:0x7f6119074a40], WT_SESSION.create: __posix_open_file, 715: /data/db/_mdb_catalog.wt: handle-open: open: File exists Raw: [1553494203:999855][23018:0x7f6119074a40], WT_SESSION.create: __posix_open_file, 715: /data/db/_mdb_catalog.wt: handle-open: open: File exists
I STORAGE  [initandlisten] WiredTiger message unexpected file _mdb_catalog.wt found, renamed to _mdb_catalog.wt.1
I CONTROL  [initandlisten]
I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
I CONTROL  [initandlisten]
I CONTROL  [initandlisten]
I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 3824 processes, 65535 files. Number of processes should be at least 32767.5 : 0.5 times number of files.
I STORAGE  [initandlisten] createCollection: admin.system.version with provided UUID: 47d8713d-ac61-4081-83bf-60209ad60a7d
W ASIO     [initandlisten] No TransportLayer configured during NetworkInterface startup
I COMMAND  [initandlisten] setting featureCompatibilityVersion to 4.0
I STORAGE  [initandlisten] repairDatabase admin
I STORAGE  [initandlisten] Repairing collection admin.system.version
I STORAGE  [initandlisten] Verify succeeded on uri table:collection-0-4352287918877967674. Not salvaging.
I INDEX    [initandlisten] build index on: admin.system.version properties: { v: 2, key: { _id: 1 }, name: "_id_", ns: "admin.system.version" }
I INDEX    [initandlisten]          building index using bulk method; build may temporarily use up to 500 megabytes of RAM
I STORAGE  [initandlisten] finished checking dbs
I STORAGE  [initandlisten] WiredTigerKVEngine shutting down
I STORAGE  [initandlisten] Shutting down session sweeper thread
I STORAGE  [initandlisten] Finished shutting down session sweeper thread
I STORAGE  [initandlisten] shutdown: removing fs lock...
I CONTROL  [initandlisten] now exiting
I CONTROL  [initandlisten] shutting down with code:0

Does anyone understand what's happening? does anyone know how to recover this mongodb?

0

There may be some permission issue with the restored files causing you the MongoDB startup failure.

Reference Link:

WiredTiger "handle-open: open: File exists"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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