0

I am currently having issues with sudo service mongod start/stop/etc so instead I have been running mongo with sudo mongod --storageEngine wiredTiger --dbpath /data --bind_ip_all --logpath /var/log/mongodb/mongod.log --auth --fork but I received errors if I wanted to change any of those --options (such as --bind_ip_all to something more specific) to something else and I am assuming it is because the --fork has never been cancelled.

To summarize, how do you cancel mongod through the cli so that I can update the call?

1

You just kill the process. killall mongod

To check that you don't have any mongod process running anymore, you can use ps -ef|grep mongod|grep -v grep or just pgrep mongod. With that latter, if you get pid number (as answer), mongod is still running

| improve this answer | |
0

The --fork is a flag to tell mongod to run as a background process, rather than as an active process which blocks the shell.

Mongod is the main daemon process for MongoDB. It's the core unit of the database, handling connections, requests, and the most important part of it, persisting of data, or writing your data at a disk. A daemon is a program or a process that's meant to be run and not interacted with in a direct manner.

By convention, daemons have a "d" appended to the end of their name, hence the name mongod. when we run mongod, we don't interact with it directly. Instead, our application utilizes a driver to communicate. The user interaction is at the application level and the driver handles all the nitty gritty details of communication with mongod.

Through mongo shell run the below command:

>killall mongod

It will kill your all background running pid of mongod process.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.