From charlesreid1

 
(42 intermediate revisions by one other user not shown)
Line 1: Line 1:
=Getting Started=
The short version: Just use docker. MongoDB authentication documentation is sloppy.


==Install==
https://git.charlesreid1.com/docker/d-mongodb


Was able to install this ok with Homebrew http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
https://git.charlesreid1.com/docker/d-mongoexpress


==First Project with Python and MongoDB==
=Summary=


http://docs.mongodb.org/ecosystem/tutorial/write-a-tumblelog-application-with-flask-mongoengine/
The brief summary:
* MongoDB provides a nosql unstructured data store for arbitrarily complicated json structures
* Listens on port 27017
* Install from mongodb.org debian repos
* Config handles file paths, logging, security, networking
* Multiple ways to interface (command line shell in Javascript, or via language bindings)
* Users must be created per-database, or a system-wide admin account added
* Enable user access controls, expose to private management LAN interfaces


=MongoDB Design Patterns=
=Installing=


So far, one of the more useful design patterns I've come up with for MongoDB tables is to always implement tables in pairs: one table to hold data, one table to hold metadata. This allows you to optimize for storage by using shorter keys, numerical codes, etc., but also store the "full name" for that information.
==Native Installation==


So the data table might contain columns named B150020221, B150020222, etc., with unique values for each row; and the metadata table would contain a list of strings, i.e., B150020221 = "mean of variable 1", B150020222 = "variance of variable 1", etc.
[[MongoDB/Manual Installation]] - installing MongoDB manually/natively on the OS


=August 2016=
==Docker Installation==


Reset with Mongodb, now August 2016, here's what we're doing:
To run MongoDB using Docker, I recommend using a docker-pod that has both MongoDB and MongoExpress (web frontend for MongoDB).


[[Scapy/Wifi Database]] - storing wifi data in a MongoDB instance
Links:
* https://git.charlesreid1.com/docker/pod-mongo - docker pod that uses docker containers defined in the repos below to run the docker pod
* https://git.charlesreid1.com/docker/d-mongodb - docker container to run MongoDB
* https://git.charlesreid1.com/docker/d-mongoexpress - docker container to run MongoExpress


[https://pymodm.readthedocs.io/en/latest/getting-started.html#installation] - to help get going, use Python pymodm module
[[MongoDB/Docker]] - installing/running MongoDB in a docker pod


=Configuring=
[[MongoDB/Configuration]] - notes on configuring MongoDB
MongoDB documentation on configuration: https://docs.mongodb.com/manual/reference/configuration-options/
=Startup Service=
[[MongoDB/Startup]] - notes on creating a MongoDB startup service
=Access Control=
MongoDB offers two access control mechanisms: user authentication, and network access.
First, MongoDB allows you to create an admin user, which can be used to create various user accounts with different permissions levels for different data. This provides a fine-grained access control mechanism around MongoDB.
[[MongoDB/Users]] - guide to setting up admin/regular users in MongoDB to control access to data in database
Second, like any network service, MongoDB can bind to a particular network interface, allowing the network firewall to be used to restrict access to MongoDB.
[[MongoDB/Network Access]] - guide to setting up the network to access (or not allow access) to MongoDB
=Basic CRUD Operations=
MongoDB performs CRUD (create, read, update, delete) transactions/operations on the data that it stores.
[[Mongo/CRUD]]
==Advanced CRUD Operations==
Spelunking in a MongoDB database to see what's there: [[Mongo/Spelunking]]
=Basic Collections Operations=
Basic operations on collections:
[[Mongo/Collections]]
=Basic Database Operations=
Notes on basic database operations:
[[Mongo/Databases]]
=Monitoring=
==MongoDB as a Monitoring Target==
MongoDB has several mechanisms for monitoring the state of the database (per second operations, cache sizes, disk and memory usage, etc.)
Utilities like [[Netdata]] and [[Collectd]] have plugins written for MongoDB that can collect this information as part of scraping the system status.
==MongoDB as a Monitoring Data Store==
collectd has a Write_MongoDB plugin to allow collectd to write its data to MongoDB.
Plugin link: https://collectd.org/wiki/index.php/Plugin:Write_MongoDB
=APIs=
Python API: [[Pymongo]]
Java API: [[MongoDB/Java]]


=References=
=References=


* pymodm: https://pymodm.readthedocs.io/en/latest/getting-started.html
pymodm: https://pymodm.readthedocs.io/en/latest/getting-started.html
 
Database design patterns: https://docs.mongodb.com/manual/applications/data-models/
 
Cheat sheet: https://blog.codecentric.de/files/2012/12/MongoDB-CheatSheet-v1_0.pdf
 
=Related Page=
 
* [[MongoExpress]]


=Flags=
=Flags=
{{DashboardFlag}}


[[Category:MongoDB]]
[[Category:MongoDB]]
[[Category:Python]]
[[Category:Python]]
[[Category:NoSQL]]
[[Category:2018]]
[[Category:February 2018]]

Latest revision as of 19:08, 17 August 2020

The short version: Just use docker. MongoDB authentication documentation is sloppy.

https://git.charlesreid1.com/docker/d-mongodb

https://git.charlesreid1.com/docker/d-mongoexpress

Summary

The brief summary:

  • MongoDB provides a nosql unstructured data store for arbitrarily complicated json structures
  • Listens on port 27017
  • Install from mongodb.org debian repos
  • Config handles file paths, logging, security, networking
  • Multiple ways to interface (command line shell in Javascript, or via language bindings)
  • Users must be created per-database, or a system-wide admin account added
  • Enable user access controls, expose to private management LAN interfaces

Installing

Native Installation

MongoDB/Manual Installation - installing MongoDB manually/natively on the OS

Docker Installation

To run MongoDB using Docker, I recommend using a docker-pod that has both MongoDB and MongoExpress (web frontend for MongoDB).

Links:

MongoDB/Docker - installing/running MongoDB in a docker pod

Configuring

MongoDB/Configuration - notes on configuring MongoDB

MongoDB documentation on configuration: https://docs.mongodb.com/manual/reference/configuration-options/

Startup Service

MongoDB/Startup - notes on creating a MongoDB startup service

Access Control

MongoDB offers two access control mechanisms: user authentication, and network access.

First, MongoDB allows you to create an admin user, which can be used to create various user accounts with different permissions levels for different data. This provides a fine-grained access control mechanism around MongoDB.

MongoDB/Users - guide to setting up admin/regular users in MongoDB to control access to data in database

Second, like any network service, MongoDB can bind to a particular network interface, allowing the network firewall to be used to restrict access to MongoDB.

MongoDB/Network Access - guide to setting up the network to access (or not allow access) to MongoDB

Basic CRUD Operations

MongoDB performs CRUD (create, read, update, delete) transactions/operations on the data that it stores.

Mongo/CRUD

Advanced CRUD Operations

Spelunking in a MongoDB database to see what's there: Mongo/Spelunking

Basic Collections Operations

Basic operations on collections:

Mongo/Collections

Basic Database Operations

Notes on basic database operations:

Mongo/Databases

Monitoring

MongoDB as a Monitoring Target

MongoDB has several mechanisms for monitoring the state of the database (per second operations, cache sizes, disk and memory usage, etc.)

Utilities like Netdata and Collectd have plugins written for MongoDB that can collect this information as part of scraping the system status.

MongoDB as a Monitoring Data Store

collectd has a Write_MongoDB plugin to allow collectd to write its data to MongoDB.

Plugin link: https://collectd.org/wiki/index.php/Plugin:Write_MongoDB

APIs

Python API: Pymongo

Java API: MongoDB/Java

References

pymodm: https://pymodm.readthedocs.io/en/latest/getting-started.html

Database design patterns: https://docs.mongodb.com/manual/applications/data-models/

Cheat sheet: https://blog.codecentric.de/files/2012/12/MongoDB-CheatSheet-v1_0.pdf

Related Page

Flags