Property | Default | Description |
---|---|---|
url | redis[s]://[[username][:password]@][host][:port][/db-number] (see redis and rediss IANA registration for more details) |
|
socket | Object defining socket connection properties | |
socket.host | 'localhost' |
Hostname to connect to |
socket.port | 6379 |
Port to connect to |
socket.path | UNIX Socket to connect to | |
socket.connectTimeout | 5000 |
The timeout for connecting to the Redis Server (in milliseconds) |
socket.noDelay | true |
Enable/disable the use of Nagle's algorithm |
socket.keepAlive | 5000 |
Enable/disable the keep-alive functionality |
socket.tls | Set to true to enable TLS Configuration |
|
socket.reconnectStrategy | retries => Math.min(retries * 50, 500) |
A function containing the Reconnect Strategy logic |
username | ACL username (see ACL guide) | |
password | ACL password or the old "--requirepass" password | |
database | Database number to connect to (see SELECT command) |
|
modules | Object defining which Redis Modules to include | |
scripts | Object defining Lua Scripts to use with this client (see Lua Scripts) | |
commandsQueueMaxLength | Maximum length of the client's internal command queue | |
readonly | false |
Connect in READONLY mode |
legacyMode | false |
Maintain some backwards compatibility (see the Migration Guide) |
isolationPoolOptions | See the Isolated Execution Guide |
You can implement a custom reconnect strategy as a function that should:
- Receives the number of retries attempted so far.
- Should return
number | Error
:number
: the time in milliseconds to wait before trying to reconnect again.Error
: close the client and flush the commands queue.