Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongorestore for a collection results in "Killed" output and collection isn't fully restored

I type the following below:

root@:/home/deploy# mongorestore --db=dbname --collection=collectionname pathtobackupfolder/collectionname.bson

Here's the output:

2016-07-16T00:08:03.513-0400 checking for collection data in pathtobackupfolder/collectionname.bson

2016-07-16T00:08:03.525-0400 reading metadata file from pathtobackupfolder/collectionname.bson

2016-07-16T00:08:03.526-0400 restoring collectionname from file pathtobackupfolder/collectionname.bson

Killed

What's going on? I can't find anything on Google or Stackoverflow about a mongorestore resulting in "Killed". The backup folder that I'm restoring from is a collection of 12875 documents, and yet everytime I run the mongorestore, it always says "Killed", and always restores a different number that is less than the total number: 4793, 2000, 4000, etc.

The machine that I'm performing this call on is "Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-71-generic x86_64)" from Digital Ocean

Any help is appreciated. Thanks.

like image 728
swu4 Avatar asked Jul 16 '16 04:07

swu4


2 Answers

After trying the mongorestore command for the 5th and 6th time after posting this question, this time more explicit output came out that indicated it was a memory issue specific to Digital Ocean. I followed https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04 and the restore finished completely without errors.

like image 125
swu4 Avatar answered Oct 04 '22 01:10

swu4


If you are trying to solve it in docker, just increase swap memory in settings.json file

like image 28
Amir Jani Avatar answered Oct 04 '22 00:10

Amir Jani