Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to start mongod.service: Unit mongod.service not found

I follow all the steps mention in MongoDB installation documents for Ubuntu 16.04.

Steps 1:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 

Steps 2:

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list 

Steps 3:

sudo apt-get update 

Steps 4:

sudo apt-get install -y mongodb-org 

Steps 5:

sudo service mongod start 

when I started MongoDB got an error as:

Failed to start mongod.service: Unit mongod.service not found.

like image 657
Rahul Avatar asked Jan 04 '18 09:01

Rahul


People also ask

Can not start MongoDB service?

We found that the reason for this error was the dbpath variable in /etc/mongodb. conf. Previously, the default value for dbpath was /data/db. The upstart job mongodb(which comes with mongodb-10gen package) invokes the mongod with –config /etc/mongodb.

How do I unmask a MongoDB service?

so the right command to unmask it would be: sudo systemctl unmask mongod .

What is mongod process?

The mongod process is the primary database process that runs on an individual server. mongos provides a coherent MongoDB interface equivalent to a mongod from the perspective of a client. The mongosh binary provides the administrative shell.


1 Answers

Most probably unit mongodb.service is masked. Use following command to unmask it.

sudo systemctl unmask mongod

and re-run

sudo service mongod start

like image 186
Jehanzeb.Malik Avatar answered Sep 29 '22 00:09

Jehanzeb.Malik