RaysNotesMongoDB

NDS Labs Project: QMCDB

MongoDB notes

Setup and Running

  • Easiest to install from OS package manager
  • Official Docker image exists for MongoDB

On a stand-alone machine

  • Install via package-manager

Configuration

  • config file: /etc/mongodb.conf
  • set smallfiles = true when on small server

Via Docker

The Docker's "official" MongoDB container is called mongo. It can be used to create either a server or a client instance.

Opening ports

Create a security group called qmcdb-apps that opens a small set of ports (32500-32504) for app development. We attach this group to our OpenStack machine instance, and launch our MongoDB server container mapping to this port.

Launching Containers

On the Docker host machine:

  1. Create a data directory, /data/qmcdb
  2. server: docker run --name qmc-mongo -v /data/qmcdb:/data/db -p 32500:27017 -d mongo:latest
  3. client: docker run -it --rm --name qmc-mongo-client --link qmc-mongo:db mongo:latest /bin/bash
    • This brings up a shell in which one can run mongo commands like mongo
    • Mongo shell: mongo --host db --port 27017

Step 2 above makes the server available on the openstack host machine on port 32500. When the firewall is adjusted for this port (see previous section), the server is available to remote clients. Will change this to expose through MongDB's standard port (27017).

User Management

References: