Redis Configuration
In addition tohost
,port
, anddb
, you can pass any options supported by the node redis client createClient
method.
The exception to this isretry_strategy
, which takes a function argument inredis.createClient
. Hydra provides a retry_strategy (hydra._redisRetryStrategy
), which is configured via thehydra.redis.retry_strategy
option rather than being passed directly toredis.createClient
:
redis: {
host: "127.0.0.1",
port: 6379,
db: 15,
retry_strategy: {
maxReconnectionPeriod: 15,
maxDelayBetweenReconnections: 5
}
}
You also have the option of using theurl
parameter instead ofhost
,port
,db
, andpassword
. See the IANA registration for details. The following is equivalent to the above host/port/db:
redis: {
url: 'redis://127.0.0.1:6379/15'
}
Note: If you pass in _both _a URLand some combination ofhost
,port
,db
, andpassword
, the values inurl
will be overridden by the more specific entries:
redis: {
url: 'redis://127.0.0.1:6379/15',
db: 10
}
This will connect to database10
instead of database15
.
Connecting via a unix socket
Hydra supports connecting to Redis via a Unix Socket. While this isn't common, it is useful when running Redis and Hydra services on a single machine.
{
"redis": {
"path": "/tmp/redis.sock"
}
}