Document-Based Storage is an architectural abstraction in the Nuxeo Platform that allows the storage of documents in a document-oriented store, for instance NoSQL databases.
An implementation is available for MongoDB.
Nuxeo supports the following MongoDB version:
MongoDB 6.0.2
Installation
When using MongoDB 3.2 or higher the WiredTiger storage engine is the default storage engine. Please follow this documentation if you’re running on MongoDB 3.0 to activate this storage engine for better performance of write operations.
Nuxeo stores its data in a MongoDB database under the default
collection. The name of the collection is the Nuxeo repository name. If you have more than one repository configured, other collections with the names of these repositories will be used for storage.
By default MongoDB doesn't require authentication, but you can enable the client access control and create a user with the dbOwner
role.
Nuxeo Configuration
To activate MongoDB document and directories storage (as of after Nuxeo FT 9.2), add the mongodb
template to your existing list of templates (nuxeo.templates
) in nuxeo.conf
. Including the mongodb-audit
template that will also activate audit storage.
For versions of Nuxeo released previously to Nuxeo FT 9.2, if you want to activate audit and directories storage, you need to install the MongoDB extension addon. This addon includes mongodb-audit
and mongodb-directory
templates in order to store respectively audit or directories data in MongoDB. For example:
nuxeo.templates=default,mongodb,mongodb-audit
If you are not using the MongoDB extension addon for previous versions of Nuxeo, you must keep the template corresponding to your SQL database in nuxeo.templates
. For instance you could have:
nuxeo.templates=postgresql,mongodb
or
nuxeo.templates=default,mongodb
The following properties are available in nuxeo.conf
:
Property name | Description | Default value |
---|---|---|
nuxeo.mongodb.server |
The MongoDB server, either a hostname or a hostname with port or a full mongodb:// URI if you have an authentication, the pattern is: mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] |
localhost:27017 |
nuxeo.mongodb.dbname |
The MongoDB database. | 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/?maxPoolSize=200
See the MongoDB Connection String URI Format for the list of options.
TLS/SSL Configuration
If you have chosen to configure TLS/SSL then you can set up Nuxeo using nuxeo.conf
with the following properties:
nuxeo.mongodb.ssl=true
nuxeo.mongodb.truststore.path
nuxeo.mongodb.truststore.password
nuxeo.mongodb.truststore.type
nuxeo.mongodb.keystore.path
nuxeo.mongodb.keystore.password
nuxeo.mongodb.keystore.type
See the Trust Store and Key Store Configuration page for more.
Hotfixes and indexes
Since LTS 2021 (NXP-29261) indexes are defined in document schemas and created during Nuxeo start. This is fine when starting from scratch, but it is not recommended on existing instance with large amount of documents, because creating an index is an heavy operation that can timeout or impact the MongoDB performance.
Some hotfixes may add missing or needed indexes to improve the overall performances of the platform. By default, a nuxeo server restarting after having installed an Hotfix defining a new index will try to create these indexes if not existing.
On instances with large repository:
- It is recommended to create the new indexes defined by an Hotfix prior to restarting the server. Each Hotfixes Installation Notes provides the command in order to create manually any new indexes for this matter.
- The auto create index on start option could be disabled with the nuxeo conf property
nuxeo.db.indexes.create=false
as long as the Hotfixes Installation Notes are carefully reviewed in order to manually create the needed indexes.
GridFS
It is 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=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.
Connection Pool Configuration
Nuxeo has MongoDBConnectionService
to instantiate MongoDB connections in the platform. This service holds all connections to MongoDB. By default, a contribution with id default
will be contributed to the Nuxeo Platform, filled with nuxeo.mongodb.server
and nuxeo.mongodb.dbname
from nuxeo.conf
.
If the service doesn't have a registered connection for the given id, it will return the default one.
You can customize the connections used depending on the feature. To do so, you need to contribute a connection to the service as below:
<component name="[COMPONENT_NAME]">
<extension target="org.nuxeo.runtime.mongodb.MongoDBComponent" point="connection">
<connection id="[CONNECTION_ID]">
<server>mongodb://...</server>
<dbname>...</dbname>
</connection>
</extension>
</component>
Here's a list of how features resolve their connection:
Feature | Connection id |
---|---|
Audit | audit |
Directory | directory/[DIRECTORY_NAME] |
Repository | repository/[REPOSITORY_NAME] |
GridFS | blobProvider/[BLOB_PROVIDER_ID] |