After Mongodump, calling MongoRestore hangs

Urbanleg picture Urbanleg · Nov 23, 2015 · Viewed 9.1k times · Source

We are trying to do a simple MongoDump on a relatively small DB.

our steps are simple:

  1. export

  2. drop exisiting DB from target machine

  3. import on target machine

The MongoDump executes perfectly.

mongodump --out=/root/mongo-prod

The same goes for the DB drop:

mongo db_name --eval "db.dropDatabase()"

On the other hand, After calling mongoRestore

mongorestore --stopOnError --drop --db db_name /root/mongo-prod-{{ build }}/db_name/

The import process starts, and hangs on 3 specific collections with the following error repeating:

    no collection options to restore
restoring db_name.Collection4 from file /root/mongo-prod-31/db_name/Collection4.bson
        file /root/mongo-prod-31/db_name/Collection4.bson is 56625 bytes
using 1 insertion workers
[########################]                 db_name.Collection1  106.7 KB/106.7 KB  (100.0%)
[########################]                db_name.Collection2    63.5 KB/63.5 KB  (100.0%)
[######..................]                db_name.Collection3     6.7 MB/25.9 MB   (25.8%)
[########################]  db_name.Collection4    55.3 KB/55.3 KB  (100.0%)

[########################]                 db_name.Collection1  106.7 KB/106.7 KB  (100.0%)
[########################]                db_name.Collection2    63.5 KB/63.5 KB  (100.0%)
[######..................]                db_name.Collection3     6.7 MB/25.9 MB   (25.8%)
[########################]  db_name.Collection4    55.3 KB/55.3 KB  (100.0%)

******* This loops infinitely *******

p.s adding --repair to the mongodump command, creates a different error on mongorestore:

  Failed: restore error: db_name.Collection1: error restoring from /root/mongo-prod-33/db_name/Collection1.bson: insertion error: E11000 duplicate key error index: db_name.Collection1.$_id_ dup key: { : ObjectId('5651802de4b0293285f7f508') }

Answer

user2481652 picture user2481652 · Mar 10, 2019

I just spent an hour with this:

Read from archive

--archive=/backup...

Ignore the archive argument and wait for stdin

--archive /backup

Seems arguments work with either arg value or arg=value, just not archive...