了解MONGODB的部署

  • replset
  • shard

我写的《 mongodb运维之副本集实践》

https://cnodejs.org/topic/5590adbbebf9c92d17e734de

Mac OS X

Install Homebrew package manager. Then follow the steps below to install and setup MongoDB.

  1. # Update Homebrew's package database
  2. $ brew update
  3. # Install MongoDB
  4. $ brew install mongodb
  5. # Create the data directory
  6. $ sudo mkdir -p /data/db
  7. # Set permissions for the data directory
  8. $ sudo chown -R `whoami` /data/db
  9. # Run MongoDB Server
  10. $ mongod

Windows

  • Download and install the current stable release.
  • Create the data directory: C:\data\db.
  • Run MongoDB Server by opening mongod.exe in C:\Program Files\MongoDB\Server\3.2\bin.

ubuntu

https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

  1. # Import the public key used by the package management system
  2. $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
  3. # Create a source list file for MongoDB
  4. $ echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
  5. # Update the repository
  6. $ sudo apt-get update
  7. # Install the latest stable version of MongoDB
  8. $ sudo apt-get install -y mongodb-org
  9. # Start MongoDB service
  10. $ sudo service mongod start

参考 https://github.com/sahat/megaboilerplate