- 
    Type:
Bug
 - 
    Resolution: Duplicate
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: 4.2.0
 - 
    Component/s: mongorestore
 - 
    None
 - 
    Environment:VPS server, Ubuntu 18.04, 4G Ram, 2 vCPU.
 
I'm using MongoDB 4.2. mongodump finished fine without any errors. However, when I used mongorestore, I received an error like this:
2019-10-08T10:28:37.947+0000 restoring indexes for collection mydb.mycol from metadata
2019-10-08T10:38:38.799+0000 finished restoring mydb.mycol (294293 documents, 0 failures)
2019-10-08T10:38:38.799+0000 Failed: mydb.mycol: error creating indexes for mydb.mycol: createIndex error: connection(localhost:27777[-2]) unable to decode message length: read tcp 127.0.0.1:36368->127.0.0.1:27777: i/o timeout
I rerun mongodump and mongorestore several times and still had the same problem. I tried to google, some people suggests running mongorestore with --noIndexRestore. It does the job, but I want to restore the indexes too. 
 
 
I installed MongoDB 4.2 by following the instruction at: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
I ran both mongodump and mongorestore on the same VPS node (Ubuntu 18.04) which I installed MongoDB 4.2. So they all should have the same version. My backup and restore commands:
 mongodump --db mydb --host localhost:27777 --authenticationDatabase admin --username XXX --password XXX --numParallelCollections 1 --gzip --archive=/root/mdbbk.gz
 
mongorestore --nsFrom $db$.$col$ --nsTo BKTEST_$db$.$col$ --host localhost:27777 --authenticationDatabase admin --username XXX --password XXX --numParallelCollections 1 --gzip --archive=/root/mdbbk.gz --stopOnError
 
I suspect the indices would take a long time to be rebuilt. So the server timeouts. That's why it said read tcp 127.0.0.1:36368->127.0.0.1:27777: i/o timeout in the log.
- duplicates
 - 
                    
TOOLS-2381 Restore no socket timeout behavior
-         
 - Closed
 
 -