Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Open source

Redis options

You can configure the Redis Client by using a Redis connection URL as demonstrated in the client documentation, or by using an Options object to access more advanced configuration.

Options

The configuration for the overall Redis client, including authentication and connection settings.

Option NameTypeDescription
socketSocketOptionsThe configuration of the connection socket used to connect to the Redis server.
usernameString (optional)Username for client authentication.
passwordString (optional)Password for client authentication.
clientNameString (optional)Name for the client connection.
databaseNumber (optional)Database ID to select after connecting.
masterNameString (optional)Master instance name for Sentinel.
sentinelUsernameString (optional)Username for Sentinel authentication.
sentinelPasswordString (optional)Password for Sentinel authentication.
clusterClusterOptions (optional)The configuration for Redis Cluster connections.

Socket Connection Options

Socket-level settings for connecting to a Redis server.

Option NameTypeDescription
hostStringIP address or hostname of the Redis server.
portNumber (optional)Port number of the Redis server.
tlsTLSOptions (optional)The configuration for TLS/SSL.
dialTimeoutNumber (optional, default is 5 (seconds))Timeout for establishing a connection, in seconds.
readTimeoutNumber (optional, default is 3 (seconds))Timeout for socket reads, in seconds. A value of -1 disables the timeout.
writeTimeoutNumber (optional, default is readTimeout)Timeout for socket writes, in seconds. A value of -1 disables the timeout.
poolSizeNumber (optional, default is 10 (per CPU))Number of socket connections in the pool per CPU.
minIdleConnsNumber (optional)Minimum number of idle connections in the pool.
maxConnAgeNumber (optional, default is 0 (no maximum idle time))Maximum time before closing a connection.
poolTimeoutNumber (optional, readTimeout + 1)Timeout for acquiring a connection from the pool.
idleTimeoutNumber (optional, readTimeout + 1)Timeout for idle connections in the pool.
idleCheckFrequencyNumber (optional, default is 1 (minute))Frequency of idle connection checks, in minutes. A value of -1 disables the checks.

TLS Configuration Options

Options for establishing a secure TLS connection.

Option NameTypeDescription
caArrayBuffer[]Array of CA certificates.
certArrayBuffer (optional)Client certificate for mutual TLS.
keyArrayBuffer (optional)Private key associated with the client certificate.

Redis Cluster Options

Options for behavior in a Redis Cluster setup.

Option NameTypeDescription
maxRedirectsNumber (optional, default is 3 retries)Maximum number of command redirects.
readOnlyBoolean (optional)Enables read-only mode for replicas.
routeByLatencyBoolean (optional)Route read commands by latency.
routeRandomlyBoolean (optional)Random routing for read commands.
nodesString[] or SocketOptions[]List of cluster nodes as URLs or SocketOptions.