StorageEngine: MongoDB

Data Serialization

Python Driver

PyMongo

Installation

Install MongoDB on OSX

  • ref: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
  • Update Brew Packages
    brew update
    
  • Install MongoDB with openssl
    brew install mongodb --with-openssl
    
    • Output
      Updating Homebrew...
      ==> Installing dependencies for mongodb: openssl
      ==> Installing mongodb dependency: openssl
      ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2l.sierra.bottle.tar.gz
      ######################################################################## 100.0%
      ==> Pouring openssl-1.0.2l.sierra.bottle.tar.gz
      ==> Caveats
      A CA file has been bootstrapped using certificates from the SystemRoots
      keychain. To add additional certificates (e.g. the certificates added in
      the System keychain), place .pem files in
        /usr/local/etc/openssl/certs
      
      and run
        /usr/local/opt/openssl/bin/c_rehash
      
      This formula is keg-only, which means it was not symlinked into /usr/local,
      because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.
      
      If you need to have this software first in your PATH run:
        echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
      
      For compilers to find this software you may need to set:
          LDFLAGS:  -L/usr/local/opt/openssl/lib
          CPPFLAGS: -I/usr/local/opt/openssl/include
      
      ==> Summary
      /usr/local/Cellar/openssl/1.0.2l: 1,709 files, 12.2MB
      Warning: mongodb: this formula has no --with-openssl option so it will be ignored!
      ==> Installing mongodb
      ==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.4.7.sierra.bottle.1.tar.gz
      ######################################################################## 100.0%
      ==> Pouring mongodb-3.4.7.sierra.bottle.1.tar.gz
      ==> Caveats
      To have launchd start mongodb now and restart at login:
        brew services start mongodb
      Or, if you don't want/need a background service you can just run:
        mongod --config /usr/local/etc/mongod.conf
      ==> Summary
      /usr/local/Cellar/mongodb/3.4.7: 19 files, 281.9MB
      
  • Create data directory
    mkdir -p ~/workspace/mongodb/db
    
  • Update mongod.conf
    • vim /usr/local/etc/mongod.conf
      systemLog:
        destination: file
        path: /Users/dream/workspace/mongodb/mongo.log
        logAppend: true
      storage:
        dbPath: /Users/dream/workspace/mongodb/db
      net:
        bindIp: 127.0.0.1
      
  • Run MongDB service
    mongod --config /usr/local/etc/mongod.conf
    

External References

Last modified 2 years ago Last modified on 09/30/17 06:25:41