Redis Client Configuration¶
springboot-data-redis¶
Sentinel¶
sentinel.master sentinel.nodes sentinel.username sentinel.password
cluster¶
cluster.nodes cluster.maxRedirects
Pool¶
jedis¶
jedis.pool.enabled
jedis.pool.maxIdle
jedis.pool.minIdle
jedis.pool.maxActive
jedis.pool.maxWait
jedis.pool.timeBetweenEvictionRuns
lettuce¶
Cluster¶
Refresh¶
Lettuce¶
lettuce.pool.enabled lettuce.pool.maxIdle lettuce.pool.minIdle lettuce.pool.maxActive lettuce.pool.maxWait lettuce.pool.timeBetweenEvictionRuns lettuce.shutdownTimeout 100 lettuce.cluster.refresh.dynamicRefreshSources true lettuce.cluster.refresh.period lettuce.cluster.refresh.adaptiveRedisson¶
BaseConfig idleConnectionTimeout connectTimeout timeout retryAttempts retryInterval password username subscriptionsPerConnection clientName sslEnableEndpointIdentification sslProvider sslTruststore sslTruststorePassword sslKeystore sslKeystorePassword sslProtocols pingConnectionInterval keepAlive tcpNoDelay nameMapper
SingleServerConfig address subscriptionConnectionMinimumIdleSize subscriptionConnectionPoolSize connectionMinimumIdleSize connectionPoolSize database dnsMonitoringInterval
BaseMasterSlaveServersConfig
loadBalancer slaveConnectionMinimumIdleSize slaveConnectionPoolSize failedSlaveReconnectionInterval failedSlaveCheckInterval masterConnectionMinimumIdleSize masterConnectionPoolSize readMode
subscriptionMode
subscriptionConnectionMinimumIdleSize subscriptionConnectionPoolSize dnsMonitoringInterval
SentinelServersConfig
sentinelAddresses masterName sentinelUsername sentinelPassword database scanInterval checkSentinelsList checkSlaveStatusWithSyncing sentinelsDiscovery
ClusterServersConfig
natMapper nodeAddresses scanInterval checkSlotsCoverage
go-redis¶
Base¶
Dialer creates new network connection and has priority over Network and Addr options.
Hook that is called when new connection is established.
Use the specified Username to authenticate the current connection with one of the connections defined in the ACL list when connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system.
Optional password. Must match the password specified in the requirepass server configuration option (if connecting to a Redis 5.0 instance, or lower), or the User Password when connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system.
Maximum number of retries before giving up. Default is 3 retries; -1 (not 0) disables retries.
Minimum backoff between each retry. Default is 8 milliseconds; -1 disables backoff.
Maximum backoff between each retry. Default is 512 milliseconds; -1 disables backoff.
Dial timeout for establishing new connections. Default is 5 seconds.
Timeout for socket reads. If reached, commands will fail with a timeout instead of blocking. Use value -1 for no timeout and 0 for default. Default is 3 seconds.
Timeout for socket writes. If reached, commands will fail with a timeout instead of blocking. Default is ReadTimeout.
Type of connection pool. true for FIFO pool, false for LIFO pool.
Note that fifo has higher overhead compared to lifo. PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO) for sentinel or cluster.
Maximum number of socket connections. Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.
cluster: // PoolSize applies per cluster node and not for the whole cluster.
Minimum number of idle connections which is useful when establishing new connection is slow.
Connection age at which client retires (closes) the connection. Default is to not close aged connections.
Amount of time client waits for connection if all connections are busy before returning an error. Default is ReadTimeout + 1 second.
Amount of time after which client closes idle connections. Should be less than server's timeout. Default is 5 minutes. -1 disables idle timeout check.
Frequency of idle checks made by idle connections reaper. Default is 1 minute. -1 disables idle connections reaper, but idle connections are still discarded by the client if IdleTimeout is set.
TLS Config to use. When set TLS will be negotiated.
Options¶
The network type, either tcp or unix. Default is tcp.
host:port address.
Database to be selected after connecting to the server.
Enables read only queries on slave nodes.
Limiter interface used to implemented circuit breaker or rate limiter.
FailoverOptions¶
The master name.
A seed list of host:port addresses of sentinel nodes.
If specified with SentinelPassword, enables ACL-based authentication (via AUTH <user>
<pass>
).
Sentinel password from "requirepass <password>
" (if enabled) in Sentinel configuration, or, if SentinelUsername is also supplied, used for ACL-based authentication.
Allows routing read-only commands to the closest master or slave node. This option only works with NewFailoverClusterClient.
Allows routing read-only commands to the random master or slave node. This option only works with NewFailoverClusterClient.
Route all commands to slave read-only nodes.
Use slaves disconnected with master when cannot get connected slaves Now, this option only works in RandomSlaveAddr function.
Database to be selected after connecting to the server.
ClusterOptions¶
A seed list of host:port addresses of cluster nodes.
NewClient creates a cluster node client with provided name and options.
The maximum number of retries before giving up. Command is retried on network errors and MOVED/ASK redirects. Default is 3 retries.
Enables read-only commands on slave nodes.
Allows routing read-only commands to the closest master or slave node. It automatically enables ReadOnly.
Allows routing read-only commands to the random master or slave node. It automatically enables ReadOnly.
Optional function that returns cluster slots information. It is useful to manually create cluster of standalone Redis servers and load-balance read/write operations between master and slaves. It can use service like ZooKeeper to maintain configuration information and Cluster.ReloadState to manually trigger state reloading.