What is the correct way to start a mongod service on linux / OS X?

前端 未结 11 1784
予麋鹿
予麋鹿 2020-11-30 16:39

I\'ve installed mongodb and have been able to run it, work with it, do simple DB read / write type stuff. Now I\'m trying to set up my Mac to run mongod as a service.

11条回答
  •  鱼传尺愫
    2020-11-30 17:10

    With recent builds of mongodb community edition, this is straightforward.

    When you install via brew, it tells you what exactly to do. There is no need to create a new launch control file.

    $ brew install mongodb
    ==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.0.6.yosemite.bottle.tar.gz ### 100.0%
    ==> Pouring mongodb-3.0.6.yosemite.bottle.tar.gz
    ==> Caveats
    To have launchd start mongodb at login:
      ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
    Then to load mongodb now:
      launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
    Or, if you don't want/need launchctl, you can just run:
      mongod --config /usr/local/etc/mongod.conf
    ==> Summary
    

提交回复
热议问题