I installed MongoDB on Ubuntu 14.04 as per the documentation. It runs and works fine, except that it mysteriously stops every few hours and requires a manual restart with service mongod restart
to get going again. There's nothing in the mongod.log when this happens.
In addition, when I restart and then check status with service mongod status
, it gives me mongod stop/waiting
event hough the application is able to connect to it. I've been searching around on how to debug this, but am stuck at this point.
It turns out the issue was with OOMkiller killing the mongod process. As noted in the MongoDB production notes (https://docs.mongodb.com/v3.2/administration/production-notes/#disk-and-storage-systems):
I used the below commands to create the swap file, which fixed the issue (on Ubuntu 14.04):
I then added the following to the
/etc/fstab
file to make this permanent:You need to first uninstall the mongodb, you can use:
After this, install mongodb by
And then update:
You are done with the installation of mongodb. You can check it by using the below command: