MongoDB/March 2017: Difference between revisions
From charlesreid1
No edit summary |
|||
| Line 17: | Line 17: | ||
* https://pymodm.readthedocs.io/en/latest/getting-started.html#installation | * https://pymodm.readthedocs.io/en/latest/getting-started.html#installation | ||
=Installing | =Installing= | ||
==Mac== | ==Mac== | ||
| Line 34: | Line 34: | ||
<pre> | <pre> | ||
apt-get install mongodb | apt-get install mongodb | ||
apt-get install python-pip. # may be necessary | |||
pip install pymodm | pip install pymodm | ||
</pre> | |||
==Configuration File== | |||
On a Mac, the configuration file should be located in <code>/usr/local/etc/mongod.conf</code>. | |||
On Unbuntu, the config file should be in </code>/etc/mongod.conf</code>. | |||
Here are the contents of the default configuration file: | |||
'''mongod.conf (default)''' | |||
<pre> | |||
systemLog: | |||
destination: file | |||
path: /usr/local/var/log/mongodb/mongo.log | |||
logAppend: true | |||
storage: | |||
dbPath: /usr/local/var/mongodb | |||
net: | |||
bindIp: 127.0.0.1 | |||
</pre> | |||
... | |||
==Starting with Specified Configuration File== | |||
To start with a specified config file, use the <code>-f<code> flag: | |||
<pre> | |||
mongod -f /usr/local/etc/mongod.conf | |||
</pre> | </pre> | ||
Revision as of 07:10, 30 March 2017
Covering some notes on MongoDB for the UGR wifi project.
MongoDB goals:
- Get it set up and working locally with a test database script
- Add records
- Drop records
- Query records - for all records within a date range, for all records matching a mac address, for all clients on a certain network, for all macs matching a certain prefix pattern
- Get MongoDB working over stunnel
- Get MongoDB set up in a docker container with a persistent data storage volume
Use the already-finished instructions here:
Also use the PyMODM library:
Installing
Mac
On a Mac, to test things out:
brew install mongodb pip install pymodm
Ubuntu
On Ubuntu, the eventual server platform:
apt-get install mongodb apt-get install python-pip. # may be necessary pip install pymodm
Configuration File
On a Mac, the configuration file should be located in /usr/local/etc/mongod.conf.
On Unbuntu, the config file should be in /etc/mongod.conf.
Here are the contents of the default configuration file:
mongod.conf (default)
systemLog: destination: file path: /usr/local/var/log/mongodb/mongo.log logAppend: true storage: dbPath: /usr/local/var/mongodb net: bindIp: 127.0.0.1
...
Starting with Specified Configuration File
To start with a specified config file, use the -f flag:
mongod -f /usr/local/etc/mongod.conf