What's a clean way to stop mongod on Mac OS X?

whatsapp
whats app
what'd
whatsapp app
what's
whatsapp web download
how to pronounce what
what does

i'm running mongo 1.8.2 and trying to see how to cleanly shut it down on Mac.

on our ubuntu servers i can shutdown mongo cleanly from the mongo shell with:

> use admin
> db.shutdownServer()

but on my Mac, it does not kill the mongod process. the output shows that it 'should be' shutdown but when i ps -ef | grep mongo it shows me an active process. also, i can still open a mongo shell and query my dbs like it was never shutdown.

the output from my db.shutdownServer() locally is:

MongoDB shell version: 1.8.2
connecting to: test
> use admin                  
switched to db admin
> db.shutdownServer()
Tue Dec 13 11:44:21 DBClientCursor::init call() failed
Tue Dec 13 11:44:21 query failed : admin.$cmd { shutdown: 1.0 } to: 127.0.0.1
server should be down...
Tue Dec 13 11:44:21 trying reconnect to 127.0.0.1
Tue Dec 13 11:44:21 reconnect 127.0.0.1 failed couldn't connect to server 127.0.0.1
Tue Dec 13 11:44:21 Error: error doing query: unknown shell/collection.js:150

i know i can just kill the process but i'd like to do it more cleanly.

It's probably because launchctl is managing your mongod instance. If you want to start and shutdown mongod instance, unload that first:

launchctl unload -w ~/Library/LaunchAgents/org.mongodb.mongod.plist

Then start mongod manually:

mongod -f path/to/mongod.conf --fork

You can find your mongod.conf location from ~/Library/LaunchAgents/org.mongodb.mongod.plist.

After that, db.shutdownServer() would work just fine.

Added Feb 22 2014:

If you have mongodb installed via homebrew, homebrew actually has a handy brew services command. To show current running services:

brew services list

To start mongodb:

brew services start mongodb

To stop mongodb if it's already running:

brew services stop mongodb

Update

As edufinn pointed out in the comment, brew services is now available as user-defined command and can be installed with following command: brew tap gapple/services.

What, what. [ hwuht, hwot, wuht, wot; unstressed hwuht, wuht ] WhatsApp Messenger: More than 2 billion people in over 180 countries use WhatsApp to stay in touch with friends and family, anytime and anywhere. WhatsApp is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.

If you installed mongodb with homebrew, there's an easier way:

List mongo job with launchctl:

launchctl list | grep mongo

Stop mongo job:

launchctl stop <job label>

(For me this is launchctl stop homebrew.mxcl.mongodb)

Start mongo job:

launchctl start <job label>

what, I will do what I can to help you. TranslationsEdit. show ▽what? (interrogative pronoun) WhatsApp Messenger: More than 2 billion people in over 180 countries use WhatsApp to stay in touch with friends and family, anytime and anywhere. WhatsApp is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.

Simple way is to get the process id of mongodb and kill it. Please note DO NOT USE kill -9 pid for this as it may cause damage to the database.

so, 1. get the pid of mongodb

$ pgrep mongo

you will get pid of mongo, Now

$ kill

You may use kill -15 as well

WHAT, what definition: 1. used to ask for information about people or things: 2. used in questions that show you are…. Learn more. Ask.com is the #1 question answering service that delivers the best answers from the web and real people - all in one place.

If you have installed mongodb community server via homebrew, then you can do:

brew services list

This will list the current services as below:

Name              Status  User     Plist
mongodb-community started sangeeth /Users/sangeeth/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

redis             stopped

Then you can restart mongodb by first stopping and restart:

brew services stop mongodb
brew services start mongodb

What, What definition is - —used as an interrogative expressing inquiry about the identity, nature, or value of an object or matter. How to use what in a sentence. Instead of funding a police department, a sizable chunk of a city's budget is invested in communities, especially marginalized ones where much of the policing occurs.

I prefer to stop the MongoDB server using the port command itself.

sudo port unload mongodb

And to start it again.

sudo port load mongodb

What, Usage Note: When what is the subject of a clause, it takes a singular verb if the word or phrase that completes the sentence (the complement) is singular, as in I Seen a font in use and want to know what it is? Upload an image to WhatTheFont to find the closest matches in our database.

What's wrong with WhatsApp | Technology, What's wrong with WhatsApp. Illustration: Jo Raynsford/Guardian Design. As social media has become more inhospitable, the appeal of private Öffne WhatsApp auf deinem Telefon. Tippe auf Menü oder Einstellungen und wähle WhatsApp Web.; Richte dein Telefon auf diesen Bildschirm, um den Code zu scannen.

P!nk - So What (Official Music Video), P!nk's official music video for 'So What'. Click to listen to P!nk on Spotify: http:// smarturl.it Duration: 3:46 Posted: 25 Oct 2009 What's In A Name? The History Of Karens, Beckys And Miss Anns Before 2020, the Karen was known by other names. NPR's Code Switch looks at the evolution of the entitled white woman, how her name

What is Tencent?, The Chinese firm's investments include Fortnite, Tesla and Universal Music - but it's under fire in the US. There is only one thing which can prove both the safety and efficacy of a vaccine; the test of time. I am not an anti-vaxxer; when Mike got pneumonia a number of years ago, which required a two-week hospitalization, I turned to my sister-in-law, the family's NP, for advice; she suggested that I have a Pneumovax shot, and I got it immediately from an NP at our local pharmacy.

Comments
  • How have you started mongod? Just at the shell? Using launchctl?
  • Do you have any information from the logs? It could be that MongoDB is "auto-restarting". You may want to run with --logappend, though a brand new log file is a clear indication that the process restarted.
  • In case anyone is interested, currently, if you have mongodb installed via homebrew you would actually need to do launchctl stop homebrew.mxcl.mongodb to stop mongodb.
  • As Sep. 2014, there is a deprecation notice in brew regarding brew services: $ brew services Warning: brew services is unsupported and will be removed soon.
  • As Dec. 2014, brew services has been removed. $ brew services Error: Unknown command: services
  • brew services is now available as user-defined command and can be installed with following command: brew tap gapple/services.
  • After I start the mongodb service, my node server is unable to connect to it. However if I start the mongodb from command line, it works fine. I guess it must be port issue.. How to set the port when starting the service ?