other services like apache2, etc are working fine.
But when I type sudo service mongod start
I get this error:
mongod: unrecognized service
I have this file:
/lib/systemd/system/mongod.service
It says this:
[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
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for for mongod as specified in
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
[Install]
WantedBy=multi-user.target
Best Answer
I had the same problem after pulling the ubuntu:17:04 docker image and installing mongodb-org
It looks like Mongodb created a systemd startup file which was already replaced by upstart.
As a workaround:
Create a new file
/etc/init/mongod.conf
(requires sudo rights). You can use:sudo gedit /etc/init/mongod.conf
Paste the following contents into the newly created upstart file:
Now, you can use the following commands:
sudo service mongod start
sudo service mongod stop
sudo service mongod status
reference: https://github.com/mongodb/mongo/blob/master/debian/mongod.upstart