Nuxeo instances should be configured with a Redis server (in addition to the regular SQL database) in the following cases:
- When it's important that asynchronous jobs not yet executed be kept across server restarts.
- In cluster mode to allow:
- Execution of some asynchronous jobs on dedicated nodes (for instance image conversion or fulltext extraction).
- A distributed Transient Store, required for Batch Upload and Asynchronous Conversion Works (Redis is not needed anymore for this since Nuxeo 10.10, see below).
- Relying on the
RedisCache
as a distributed implementation of the Nuxeo Drive synchronization roots cache. - Cluster cache invalidations
- Your infrastructure is willing to store less than hundred millions of documents, otherwise you should consider using Kafka.
Until Nuxeo 9.10 for a robust production instance, the first point is always necessary, which means that Redis should always be used. Visit the Nuxeo and Redis page for more information.
Since Nuxeo 9.10 Nuxeo Stream has been introduced and enables to use an alternative work manager that can rely on Kafka for the cluster mode, this cover point 1 and for some configuration point 2.
Since Nuxeo 10.10, the default transient store is KeyValueBlobTransientStore
even if Redis is configured. To use the old RedisTransientStore
you must set nuxeo.transientstore.provider=redis
.
Configuring Redis
The Nuxeo Platform supports the following Redis versions:
Nuxeo Platform Version: | LTS 2021 | LTS 2019 | LTS 2017 | LTS 2016 |
---|---|---|---|---|
Redis | 2.8.x 3.0.x 3.2.x 4.0.x 5.0.x 6.0.x |
2.8.x 3.0.x 3.2.x 4.0.x |
2.8.x 3.0.x 3.2.x 4.0.x |
2.8.x 3.0.x 3.2.x 4.0.x |
The following Redis configuration points should be checked:
- The server memory should be enough to hold the Redis database (the size depends on the usage: transient store, cache, the backlog of asynchronous jobs).
- Redis persistence should be configured appropriately for the level of service required. In particular the RDB files should be used as backups and periodically saved offsite.
- Redis master-slave replication should be set up, for robustness (fast disaster recovery). Note that Nuxeo Platform 5.8 does not yet know how to use the slaves for read-only operation.
Configuring Nuxeo for Redis
To make the Nuxeo Platform use Redis, you must activate the redis
template by adding it to the nuxeo.templates
property of bin/nuxeo.conf
, and specify the Redis hostname:
nuxeo.templates=default,...,redis
nuxeo.redis.host=redishost
The nuxeo.redis.host
must be the hostname or IP address of your master Redis server. All the Nuxeo instances in a Nuxeo cluster must of course point to the same Redis server.
Also available are (with defaults):
nuxeo.redis.port=6379
nuxeo.redis.prefix=nuxeo:
nuxeo.redis.password=
nuxeo.redis.database=0
nuxeo.redis.timeout=2000
nuxeo.redis.maxTotal=16
nuxeo.redis.maxIdle=8
nuxeo.work.queuing=redis
The nuxeo.redis.port
is self-explanatory, 6379 is the value for a default Redis installation.
The nuxeo.redis.prefix
is the prefix used for all Nuxeo keys stored and read in Redis. This allows you to use a single Redis server between several Nuxeo cluster installations by having a different prefix for each cluster, but this is not really recommended. All keys used for Work queue management have work:
added after this prefix. Those related to caching use cache:
after this prefix. For locking, lock:
followed by the repository name is used.
The nuxeo.redis.password
, nuxeo.redis.database
and nuxeo.redis.timeout
are standard Redis parameters, although rarely used.
nuxeo.redis.maxTotal
sets the maximum size of the Redis connections pool (available since 8.2).
nuxeo.redis.maxIdle
sets the maximum number of Redis idle connections in the pool (available since since 8.2).
When the redis
template is used then the following is automatically activated as well:
nuxeo.work.queuing=redis
.
(As of Nuxeo Platform 5.8, work queuing is the only use of Redis in the standard Nuxeo modules, so it makes sense to activate both together.)
TLS/SSL
If you have chosen to configure TLS/SSL then you can set up Nuxeo using nuxeo.conf
with the following properties:
nuxeo.redis.ssl=true
nuxeo.redis.truststore.path
nuxeo.redis.truststore.password
nuxeo.redis.truststore.type
nuxeo.redis.keystore.path
nuxeo.redis.keystore.password
nuxeo.redis.keystore.type
See the Trust Store and Key Store Configuration page for more.
clustering
To activate the Redis cluster invalidation in cluster mode you need to add:
repository.clustering.invalidation=pubsub
You can monitor that your cluster is able to send invalidations request using that command:
redis-cli psubscribe "*"
After editing a document, you should be able to see such message:
1) "pmessage"
2) "*"
3) "nuxeo:vcs:default"
4) "2:\xac\xed\x00\x05sr\x00,org.nuxeo.ecm.core.storage.sql.Invalidations..."
High Availability
If needed, you may configure nuxeo for resolving the Redis server through sentinels.
nuxeo.redis.ha.enabled=true
nuxeo.redis.ha.master=mymaster
nuxeo.redis.ha.hosts=sentinel1,sentinel2,....
nuxeo.redis.ha.port=26379
Nuxeo will ask sentinel hosts in the declaring order at port 26379 for the server mymaster.