Autostart/Upstart Mongodb on Ubuntu 16.04 Xenial Xerus

ubuntu-1604-thumb

Check for Mongodb systemctl status by:

sudo systemctl status mongod

Enable the Mongodb Autostart/upstart with system start up:

sudo systemctl enable mongod

Note: if both of the commands returning a service not found message, then check if the service entry exist in either

/lib/systemd/system/mongod.service

and

/etc/systemd/system/mongodb.service

If not then refer to Mongodb Documentation to create the systemd service file for Ubuntu 16.04 at this path:

/lib/systemd/system/mongod.service

With this content:

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual
 
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
 
[Install]
WantedBy=multi-user.target

And go back to the start of this article.

Leave a Reply