Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Web Technology by (50.2k points)

I am very new at Mongo. I am running mongod as described here in Mac OS X. I am running two mongod processes from the command line. If I need to stop the mongod processes I just execute kill <pid of mongod>. Is it the recommended way to stop mongod?

1 Answer

0 votes
by (108k points)

$mongo admin --eval "db.shutdownServer()"

MongoDB shell version: 2.6.4

connecting to: admin

2015-02-19T10:54:22.574+0200 DBClientCursor::init call() failed

server should be down...

It's returning some odd messages, but it works.

And I have made alias-command for running it easy.

alias stop-mongo='/opt/mongo/release/bin/mongo admin --eval "db.shutdownServer()"'

This works at least if you start your mongo manually (e.g. with --fork option).

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
asked Oct 16, 2019 in Web Technology by Sammy (47.6k points)
0 votes
3 answers

Browse Categories

...