Skip to content

Latest commit

 

History

History
42 lines (25 loc) · 1.66 KB

MongoDB.md

File metadata and controls

42 lines (25 loc) · 1.66 KB

Instructions for initialling MongoDB

For this assignment, you can install MongoDB Community Edition for all of the function required. The specific instructions about installation is as follow.

  1. Import the public key used by package management system of Ubuntu. You can do this by any package management tools for importing the public key. Here is an example using apt:
  • sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
  1. Create a list file for MongoDB. Since we are using Ubuntu 14 in the cluster, you can use this command to create the list file.
  1. Reload local package database. This can be simplely done by:
  • sudo apt-get update
  1. Install MongoDB packages Now you can finally get the MongoDB package and install it! The command is simple:
  • sudo apt-get install -y mongodb-org

If you want to install a specific version of MongoDB, please follow the format like this:

  • sudo apt-get install -y mongodb-org=3.2.3 mongodb-org-server=3.2.3 mongodb-org-shell=3.2.3 mongodb-org-mongos=3.2.3 mongodb-org-tools=3.2.3

Instructions for running MongoDB

Now that you have successfully install MongoDB in your cluster, let's go over some easy commands to run MongoDB.

  1. To start MongoDB, you can use the start command:
  • sudo service mongod start
  1. To stop it, just use stop:
  • sudo service mongod stop
  1. You can also restart using the restart command
  • sudo service mongod restart
  1. For more instructions on how to use the mongo shell, please refer to this