Report this

What is the reason for this report?

mongorestore fails with "out of memory"

Posted on October 6, 2015

I need to import my db from the old hosting. Iv’e already exported it from the old hosting using mongodump and now trying the following:

mongorestore -h 127.0.0.1 -d bassfunk_moscow dump/bassfunk_moscow/

it stops with the fatal error: runtime: out of memory

Here is all the log: http://pastebin.com/7YHaxwp3

What should be my next steps? I’m lost here. The DB dump is not that big - about 50mb.

uname -a
Linux bassfunk 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This message would indicate that the mongo process itself attempted to allocate more memory but there was none (or not enough) left for the operating system to allocate it. If you are on a 512MB or 1GB droplet I would recommend creating a swap file on your droplet. With a swap file, if your droplet runs out of physical memory it will use the file to swap out memory data to the disk, preventing this type of issue.

While this will prevent the process from crashing (or at least ensure it takes a lot more to get to that point), having a lot of memory swapped out to disk will slow things down as it is much slower for the OS to query the data in a swap file than to do so from RAM. For this reason, I would also recommend running free -m once you have completed your import and your services are running normally in order to ensure that you have enough memory available for normal operation.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.