Sane defaults for MongoDB on OSX?

前端 未结 3 752
野的像风
野的像风 2021-02-05 20:09

I installed MongoDB and have set it up like so:

DB path: /data/db

System-wide config file: /usr/local/mongodb/mongod.conf

launc

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 20:48

    The only one of these values for which MongoDB has a default is the data path, which is /data/db. MongoDB by itself does not ship with a config file, nor does it log to a file by default, and the choice of where to install the binaries is entirely up to you.

    For my own installation, I use the following:

    • config: /usr/local/mongo/mongod.conf
    • dbpath: /usr/local/mongo/data
    • logging: /private/var/etc/mongodb.log (this then shows up automatically in the Console app)
    • launchctl: /Library/LaunchDaemons/org.mongodb.mongod.plist

    The only other note I'd make is that it is probably worth raising the hard and soft limits for NumberOfFiles, as MongoDB uses this limit to determine the maximum number of connections that it will accept. On some versions, OS X defaults this number to 256, which means you can have a maximum of around 205 connections, which may be too low even for a development environment. I have the following in my launchctl plist:

    HardResourceLimits
    
      NumberOfFiles
      1024
    
    SoftResourceLimits
    
      NumberOfFiles
      1024
    
    

提交回复
热议问题