27

I installed mongodb for learning purpose, the problem I am facing is that it starts on system boot and consume resources even if not being used. I want it to be removed from system boot, how can I do this?

5 Answers5

18

I can't test it at the moment, but I think this should work

 sudo update-rc.d mongodb disable

If this is not enough try this

 sudo update-rc.d -f mongodb remove
7

This worked for me and I'm using Ubuntu 18.04:

sudo systemctl disable mongod
6

This is borrowed from this answer:

echo manual | sudo tee /etc/init/mongod.override
Zanna
  • 72,312
davelupt
  • 177
4

@davelupt's reference is great. However I guess the command should be

echo manual | sudo tee /etc/init/mongod.override

since the file for MongoDB under /etc/init is mongod.conf.

Robert
  • 141
  • 2
0

For Ubuntu 18 and above use

$ sudo systemctl stop mongod

For earlier versions

$ sudo service mongod stop

For MacOS:

$ brew services stop mongodb-community@4.2

For Windows, Open CMD as Admin:

sc.exe delete MongoDB

More info can be found here

Nditah
  • 146
  • 4