Installation and Administration

MongoDB

Updated: February 11, 2019 Page Information Edit on GitHub

DBS (Document-Based Storage) is an infrastructure in the Nuxeo Platform allowing storage of documents inside a document-oriented store, like NoSQL.

The first implementation is available for MongoDB.

Nuxeo supports the following MongoDB versions:

2.8, 3.0, 3.2 (Since 7.10-HF07)

Installation

When using MongoDB 3.0 we recommand that you configure the WiredTiger storage engine for better performance of write operations. Please follow this documentation to activate this storage engine.

Nuxeo stores its information in the configured database, under the default collection. The name of the collection is the Nuxeo repository name.

By default MongoDB doesn't require authentication, you can enable the client access control and create a user with the dbAdmin role.

Users creation in versions 3.x and Nuxeo below LTS2015-HF07

If you are using a version 3.x of MongoDB, you have to change the authentication schema before creating the users in the database. In those versions, the default authentication mechanism is SCRAM-SHA-1 which is not supported by Nuxeo < LTS 2015 HF07 where the MongoDB driver only supports MONGO-CR.

Note that if you are upgrading from a 2.6 or 2.8 databases, you will be fine as the MONGO-CR credentials were previously created.

For a new MongoDB instance, use the following commands:

mongo
use admin
db.system.version.insert({ "_id" : "authSchema", "currentVersion" : 3 })

For existing MongoDB instance with users, you need to remove the user first (make sure you don't need them before) then change the authentication schema using the following commands:

mongo
use admin
db.system.users.remove({})
db.system.version.remove({})
db.system.version.insert({ "_id" : "authSchema", "currentVersion" : 3 })

Then restart the server and recreate users.

 

Configuration

To activate MongoDB document storage, add the mongodb template to your existing list of templates (nuxeo.templates) in nuxeo.conf.

You must keep the template corresponding to your SQL database in nuxeo.templates, because the SQL database may still be used for other things (directories, audit, etc.). For instance you could have:

nuxeo.templates=postgresql,mongodb

or

nuxeo.templates=default,mongodb

The following properties are available in nuxeo.conf:

  • nuxeo.mongodb.server: the MongoDB server, either a hostname or a hostname with port, or a full mongodb:// URI (defaults to localhost:27017).

    The MongoDB URI pattern is:  mongodb://[username:[email protected]]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

  • nuxeo.mongodb.dbname: the MongoDB database (defaults to nuxeo).

Using the full mongodb:// URI syntax you can configure the connection options, like the pool size, the write concern or the read preference, for instance:

nuxeo.mongodb.server=mongodb://example1.com,example2.com,example3.com/?readPreference=secondary

See the Connection String URI Format for the list of options.

GridFS

In recent Nuxeo versions or when using the appropriate Nuxeo Package, it's possible to use MongoDB's GridFS mechanism to store binary files inside MongoDB instead of the default filesystem mechanism of Nuxeo. This is activated by adding gridfsbinaries to the templates, for instance:

nuxeo.templates=postgresql,mongodb,gridfsbinaries

When doing this, binaries will be stored in the default.fs GridFS bucket, which means that in native MongoDB the collections default.fs.files and default.fs.chunks will be used. See the GridFS Reference for more details about MongoDB's GridFS implementation.

 


Related pages in current documentation
   
3 months ago manonlumeau NXDOC-1831: remove opensocial parameters
3 years ago Solen Guitter 29
3 years ago Solen Guitter 28
3 years ago Benoit Delbosc 27
3 years ago Benoit Delbosc 26 | HF07 can work with mongodb 3.2
3 years ago Gildas Lefevre 25
3 years ago Gildas Lefevre 24
3 years ago Gildas Lefevre 23
3 years ago Manon Lumeau 22 | Formatting
3 years ago Manon Lumeau 21 | NXP-18773: restored MongoDB parameters
3 years ago Florent Guillaume 20 | added gridfs
3 years ago Alain Escaffre 19
3 years ago Alain Escaffre 18
4 years ago Solen Guitter 17 | Update link, cleanup page format, update related pages
4 years ago Manon Lumeau 16
4 years ago Florent Guillaume 15
4 years ago Benoit Delbosc 14
4 years ago Benoit Delbosc 13 | Emphasis on the URI connection options
4 years ago Florent Guillaume 12
4 years ago Florent Guillaume 11 | Added nuxeo.mongodb.dbname and detailed server syntax
5 years ago Manon Lumeau 10
5 years ago RĂ©mi Cattiau 9 | As requested by Brendan
5 years ago Florent Guillaume 8
5 years ago Florent Guillaume 7
5 years ago Solen Guitter 6
5 years ago Florent Guillaume 5
5 years ago Florent Guillaume 4
5 years ago Florent Guillaume 3
5 years ago Florent Guillaume 2
5 years ago Florent Guillaume 1
History: Created by Florent Guillaume

We'd love to hear your thoughts!

All fields required