Options
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 Name | Type | Description |
---|---|---|
socket | SocketOptions | The configuration of the connection socket used to connect to the Redis server. |
username | String (optional) | Username for client authentication. |
password | String (optional) | Password for client authentication. |
clientName | String (optional) | Name for the client connection. |
database | Number (optional) | Database ID to select after connecting. |
masterName | String (optional) | Master instance name for Sentinel. |
sentinelUsername | String (optional) | Username for Sentinel authentication. |
sentinelPassword | String (optional) | Password for Sentinel authentication. |
cluster | ClusterOptions (optional) | The configuration for Redis Cluster connections. |
Socket Connection Options
Socket-level settings for connecting to a Redis server.
Option Name | Type | Description |
---|---|---|
host | String | IP address or hostname of the Redis server. |
port | Number (optional) | Port number of the Redis server. |
tls | TLSOptions (optional) | The configuration for TLS/SSL. |
dialTimeout | Number (optional, default is 5 (seconds)) | Timeout for establishing a connection, in seconds. |
readTimeout | Number (optional, default is 3 (seconds)) | Timeout for socket reads, in seconds. A value of -1 disables the timeout. |
writeTimeout | Number (optional, default is readTimeout ) | Timeout for socket writes, in seconds. A value of -1 disables the timeout. |
poolSize | Number (optional, default is 10 (per CPU)) | Number of socket connections in the pool per CPU. |
minIdleConns | Number (optional, default is 0 (idle connections are not closed by default)) | Minimum number of idle connections in the pool. |
maxConnAge | Number (optional, default is 0 (no maximum idle time)) | Maximum time before closing a connection. |
poolTimeout | Number (optional, readTimeout + 1 ) | Timeout for acquiring a connection from the pool. |
idleTimeout | Number (optional, readTimeout + 1 ) | Timeout for idle connections in the pool. |
idleCheckFrequency | Number (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 Name | Type | Description |
---|---|---|
ca | ArrayBuffer[] | Array of CA certificates. |
cert | ArrayBuffer (optional) | Client certificate for mutual TLS. |
key | ArrayBuffer (optional) | Private key associated with the client certificate. |
Redis Cluster Options
Options for behavior in a Redis Cluster setup.
Option Name | Type | Description |
---|---|---|
maxRedirects | Number (optional, default is 3 retries) | Maximum number of command redirects. |
readOnly | Boolean (optional) | Enables read-only mode for replicas. |
routeByLatency | Boolean (optional) | Route read commands by latency. |
routeRandomly | Boolean (optional) | Random routing for read commands. |
nodes | String[] or SocketOptions[] | List of cluster nodes as URLs or SocketOptions. |
Was this page helpful?
Related documentation
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
08 May

k6 1.0: How this long-awaited major release makes it easier to get started with testing
Grafana k6 v1.0 is here! k6 contributors will demonstrate features in the open source load testing tool, such as native extensibility (no more xk6 workarounds); the OpenAPI converter to streamline and automate the creation of TypeScript-based tests; and k6 Studio, a desktop application that simplifies performance testing for everyone.
60 min

Performance testing and observability in Grafana Cloud
In this webinar, learn how Grafana Cloud k6 offers you the best developer experience for performance testing.
60 min

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.