I can't figure out how to auto-restart mongodb on Ubuntu 16.04 in the event that it crashes due to memory-pressure.
I'm using supervisord for other scripts etc, but mongod is through systemctl and I'm not sure how that ties into it.
I can't figure out how to auto-restart mongodb on Ubuntu 16.04 in the event that it crashes due to memory-pressure.
I'm using supervisord for other scripts etc, but mongod is through systemctl and I'm not sure how that ties into it.
Figured it out:
sudo vim /lib/systemd/system/mongod.service
Restart=always
under service
sudo systemctl daemon-reload
Now whenever mongod gets killed. It'll get respawned by systemctl.
When you install mongoDB
just run systemctl enable mongod.service
on terminal.
This will make your mongoDB service auto-start on every restart.