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

后端 未结 9 1324
逝去的感伤
逝去的感伤 2020-12-12 09:28

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:

相关标签:
9条回答
  • 2020-12-12 10:08

    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>
    
    0 讨论(0)
  • 2020-12-12 10:08

    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

    0 讨论(0)
  • 2020-12-12 10:15

    This is an old question, but its one I found while searching as well.

    If you installed with brew then the solution would actually be the this:

    launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

    0 讨论(0)
提交回复
热议问题