You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-12-11 09:22:35 +03:00
6.9 KiB
6.9 KiB
createClient configuration
| 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 (TODO - document) | |
| 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 |
Reconnect Strategy
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.