Project

General

Profile

MAUSDocumentCacheConfiguration » History » Version 10

Jackson, Mike, 15 March 2012 17:26

1 9 Jackson, Mike
h1. How to configure MongoDB as a document cache
2 1 Jackson, Mike
3 9 Jackson, Mike
MAUS can use the MongoDB (http://www.mongodb.org/) document-oriented database to cache spills that have been transformed until they are ready to be merged. A MongoDB server holds 0 or more databases. Each database holds 1 or more collections and each collection 0 or more documents. MongoDB is schema free - the documents can be all of the same structure or of different structures.
4 1 Jackson, Mike
5 10 Jackson, Mike
h2. Set up MongoDB 
6 2 Jackson, Mike
7 1 Jackson, Mike
MongoDB can be installed using @yum@ as follows.
8
9 7 Jackson, Mike
 * Log in as a super-user by using @sudo su -@ or @su@.
10 1 Jackson, Mike
 * Edit @/etc/yum.repos.d/10gen.repo@ and add the lines
11
<pre>
12
[10gen]
13
name=10gen Repository
14
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
15
gpgcheck=0
16
</pre>
17
 * Run 
18
<pre>
19
$ yum install mongo-10gen
20
 ...
21
 mongo-10gen         i686         2.0.1-mongodb_1           10gen          28 M
22
 ...
23
$ yum install mongo-10gen-server
24
 ...
25
 mongo-10gen-server       i686       2.0.1-mongodb_1          10gen       5.4 M
26
...
27
</pre>
28
 * Start the server
29
<pre>
30
$ /sbin/service mongod start
31
Starting mongod: forked process: 4357
32
                                                           [  OK  ]
33
all output going to: /var/log/mongo/mongod.log
34
$ /sbin/service mongod status
35
mongod (pid 4357) is running...
36
</pre>
37
(as an alternative to @service mongod@ you can use @/etc/init.d/mongod@)
38
39
By default MongoDB is available on http://localhost:27017/.
40
41 10 Jackson, Mike
h2. Set up pymngo 
42 1 Jackson, Mike
43 10 Jackson, Mike
pymongo(http://api.mongodb.org/python/current/) provides a Python API to MongoDB. pymongo is automatically downloaded and installed when you build MAUS. 
44 1 Jackson, Mike
45 10 Jackson, Mike
h2. Set up MongoDB connection
46 1 Jackson, Mike
47 10 Jackson, Mike
By default MAUS is set up to use a MongoDB database running locally. 
48 1 Jackson, Mike
49 10 Jackson, Mike
If you need to change this, or make other configuration changes, then the supported configuration parameters are as follows:
50
51
 * Document store class name. This mandatory parameter specifies the MAUS Python module that handles interaction with MongoDB. The parameter and value needs to be:
52 1 Jackson, Mike
<pre>
53
doc_store_class="MongoDBDocumentStore.MongoDBDocumentStore"
54
</pre>
55
 * MongoDB host. This optional parameter specifies the MongoDB host. If omitted then the default of @localhost@ is used. To override this value do:
56
<pre>
57
mongodb_host="maus.org.uk"
58
</pre>
59
 * MongoDB port. This optional parameter specifies the MongoDB port. If omitted then the default of @27017@ is used. To override this value do:
60
<pre>
61
mongodb_port=12345
62
</pre>
63
 * MongoDB database name. This optional parameter specifies the database within MongoDB to use. If omotted then the default of @mausdb@ is used. To override this value do:
64
<pre>
65 8 Jackson, Mike
mongodb_database_name="someotherdbname" 
66
</pre>
67
 ** Note that if the database is not present in MongoDB it will be created automatically.
68
 * MongoDB collection name. This optional parameter specifies the collection within the MongoDB database to use. If omotted then the default of @spills@ is used. To override this value do:
69
<pre>
70 1 Jackson, Mike
mongodb_collection_name="someothercollectionname" 
71 8 Jackson, Mike
</pre>
72 2 Jackson, Mike
 ** Note that if the database is not present in MongoDB it will be created automatically.