Redis
Type: pubsub.redis
Status: stable
Reference: https://docs.dapr.io/reference/components-reference/supported-pubsub/setup-redis-pubsub/
Example
apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: pubsub.redis
version: v1
metadata:
# Password for Redis host. No default. Use secretKeyRef for secret reference (Optional)
#- name: redisPassword
# value: "KeFg23!"
# Username for Redis host. Defaults to empty. Make sure your Redis server version is 6 or above, and have created ACL rule correctly. (Optional)
#- name: redisUsername
# value: "my-username"
# Connection-string for the redis host. If "redisType" is "cluster" it can be multiple hosts separated by commas or just a single host
- name: redisHost
value: "redis-master.default.svc.cluster.local:6379"
# Client certificate for Redis host. No Default. Can be secretKeyRef to use a secret reference (Optional)
#- name: clientCert
# value: |
#
# Client key for Redis host. No Default. Can be secretKeyRef to use a secret reference (Optional)
#- name: clientKey
# value: |
#
# The number of concurrent workers that are processing messages. Defaults to "10". (Optional)
#- name: concurrency
# value: "15"
# The consumer group ID (Optional)
#- name: consumerID
# value: "myGroup"
# Dial timeout for establishing new connections. Defaults to "5s". (Optional)
#- name: dialTimeout
# value: "5s"
# If the Redis instance supports TLS, can be configured to be enabled or disabled. Defaults to "false". (Optional)
#- name: enableTLS
# value: "false"
# Property to enabled failover configuration. Needs sentinalMasterName to be set. Defaults to "false" (Optional)
#- name: failover
# value: "false"
# Frequency of idle checks made by idle connections reaper. Default is "1m". "-1" disables idle connections reaper. (Optional)
#- name: idleCheckFrequency
# value: "-1"
# Amount of time after which the client closes idle connections. Should be less than server's timeout. Default is "5m". "-1" disables idle timeout check. (Optional)
#- name: idleTimeout
# value: "10m"
# Connection age at which the client retires (closes) the connection. Default is to not close aged connections. (Optional)
#- name: maxConnAge
# value: "30m"
# Maximum number of items inside a stream.The old entries are automatically evicted when the specified length is reached, so that the stream is left at a constant size. Defaults to unlimited. (Optional)
#- name: maxLenApprox
# value: "10000"
# Minimum number of idle connections to keep open in order to avoid the performance degradation associated with creating new connections. Defaults to "0". (Optional)
#- name: minIdleConns
# value: "2"
# Maximum number of socket connections. Default is 10 connections per every CPU as reported by runtime.NumCPU. (Optional)
#- name: poolSize
# value: "20"
# Amount of time client waits for a connection if all connections are busy before returning an error. Default is readTimeout + 1 second. (Optional)
#- name: poolTimeout
# value: "5s"
# The amount time a message must be pending before attempting to redeliver it. Defaults to "15s". "0" disables redelivery. (Optional)
#- name: processingTimeout
# value: "30s"
# The size of the message queue for processing. Defaults to "100". (Optional)
#- name: queueDepth
# value: "1000"
# Timeout for socket reads. If reached, redis commands will fail with a timeout instead of blocking. Defaults to "3s", "-1" for no timeout. (Optional)
#- name: readTimeout
# value: "3s"
# The interval between checking for pending messages to redelivery. Defaults to "60s". "0" disables redelivery. (Optional)
#- name: redeliverInterval
# value: "30s"
# Database selected after connecting to redis. If "redisType" is "cluster" this option is ignored. Defaults to "0". (Optional)
#- name: redisDB
# value: "0"
# Maximum number of times to retry commands before giving up. Default is to not retry failed commands. (Optional)
#- name: redisMaxRetries
# value: "5"
# Maximum backoff for redis commands between each retry. Default is "512ms";"-1" disables backoff. (Optional)
#- name: redisMaxRetryInterval
# value: "5s"
# Minimum backoff for redis commands between each retry. Default is "8ms"; "-1" disables backoff. (Optional)
#- name: redisMinRetryInterval
# value: "8ms"
# The type of redis. There are two valid values, one is "node" for single node mode, the other is "cluster" for redis cluster mode. Defaults to "node". (Optional)
#- name: redisType
# value: "cluster"
# The sentinel master name. See Redis Sentinel Documentation. (Optional)
#- name: sentinelMasterName
# value: "127.0.0.1:6379"
# Timeout for socket writes. If reached, redis commands will fail with a timeout instead of blocking. Defaults is readTimeout. (Optional)
#- name: writeTimeout
# value: "3s"
Authentication profiles
Available authentication profiles:
-
Username and password
-
Azure AD: Client credentials
-
Azure AD: Client certificate
Username and password
Authenticate using username and password.
redisPassword
(string)
Password for Redis host. No default. Use secretKeyRef for secret reference
Example value: KeFg23!
redisUsername
(string)
Username for Redis host. Defaults to empty. Make sure your Redis server version is 6 or above, and have created ACL rule correctly.
Example value: my-username
Azure AD: Client credentials
Authenticate using Azure AD with client credentials, also known as "service principals".
azureClientId
Required - Client ID (application ID)
Example value: c7dd251f-811f-4ba2-a905-acd4d3f8f08b
azureClientSecret
Required - Client secret (application password)
Example value: Ecy3XG7zVZK3/vl/a2NSB+a1zXLa8RnMum/IgD0E
azureTenantId
Required - ID of the Azure AD tenant
Example value: cd4b2887-304c-47e1-b4d5-65447fdd542a
azureEnvironment
Optional name for the Azure environment if using a different Azure cloud
Default value: AzurePublicCloud
Example value: AzurePublicCloud
Allowed values:
-
AzurePublicCloud
-
AzureChinaCloud
-
AzureUSGovernmentCloud
useEntraID
(bool)
If set, enables authentication to Azure Cache for Redis using Microsoft EntraID. The Redis server must explicitly enable EntraID authentication. Note that Azure Cache for Redis also requires the use of TLS, so enableTLS
should be set. No username or password should be set.
Default value: false
Example value: true
Azure AD: Client certificate
Authenticate using Azure AD with a client certificate. "azureCertificate" is required.
azureClientId
Required - Client ID (application ID)
Example value: c7dd251f-811f-4ba2-a905-acd4d3f8f08b
azureTenantId
Required - ID of the Azure AD tenant
Example value: cd4b2887-304c-47e1-b4d5-65447fdd542a
azureCertificate
Certificate and private key (in either a PEM file containing both the certificate and key, or in PFX/PKCS#12 format)
Example value:
-----BEGIN PRIVATE KEY-----\n MIIEvgI... \n -----END PRIVATE KEY-----
\n -----BEGIN CERTIFICATE----- \n MIICoTC... \n -----END CERTIFICATE----- \n
azureCertificatePassword
Password for the certificate if encrypted.
Example value: password
azureEnvironment
Optional name for the Azure environment if using a different Azure cloud
Default value: AzurePublicCloud
Example value: AzurePublicCloud
Allowed values:
-
AzurePublicCloud
-
AzureChinaCloud
-
AzureUSGovernmentCloud
useEntraID
(bool)
If set, enables authentication to Azure Cache for Redis using Microsoft EntraID. The Redis server must explicitly enable EntraID authentication. Note that Azure Cache for Redis also requires the use of TLS, so enableTLS
should be set. No username or password should be set.
Default value: false
Example value: true
Metadata
redisHost
(string)
Required - Connection-string for the redis host. If "redisType" is "cluster" it can be multiple hosts separated by commas or just a single host
Example value: redis-master.default.svc.cluster.local:6379
clientCert
(string)
Client certificate for Redis host. No Default. Can be secretKeyRef to use a secret reference
clientKey
(string)
Client key for Redis host. No Default. Can be secretKeyRef to use a secret reference
concurrency
(number)
The number of concurrent workers that are processing messages. Defaults to "10".
Example value: 15
consumerID
(string)
The consumer group ID
Example value: myGroup
dialTimeout
(duration)
Dial timeout for establishing new connections. Defaults to "5s".
Example value: 5s
enableTLS
(bool)
If the Redis instance supports TLS, can be configured to be enabled or disabled. Defaults to "false".
Example value: false
failover
(bool)
Property to enabled failover configuration. Needs sentinalMasterName to be set. Defaults to "false"
Example value: false
idleCheckFrequency
(duration)
Frequency of idle checks made by idle connections reaper. Default is "1m". "-1" disables idle connections reaper.
Example value: -1
idleTimeout
(duration)
Amount of time after which the client closes idle connections. Should be less than server's timeout. Default is "5m". "-1" disables idle timeout check.
Example value: 10m
maxConnAge
(duration)
Connection age at which the client retires (closes) the connection. Default is to not close aged connections.
Example value: 30m
maxLenApprox
(number)
Maximum number of items inside a stream.The old entries are automatically evicted when the specified length is reached, so that the stream is left at a constant size. Defaults to unlimited.
Example value: 10000
minIdleConns
(number)
Minimum number of idle connections to keep open in order to avoid the performance degradation associated with creating new connections. Defaults to "0".
Example value: 2
poolSize
(number)
Maximum number of socket connections. Default is 10 connections per every CPU as reported by runtime.NumCPU.
Example value: 20
poolTimeout
(duration)
Amount of time client waits for a connection if all connections are busy before returning an error. Default is readTimeout + 1 second.
Example value: 5s
processingTimeout
(duration)
The amount time a message must be pending before attempting to redeliver it. Defaults to "15s". "0" disables redelivery.
Example value: 30s
queueDepth
(number)
The size of the message queue for processing. Defaults to "100".
Example value: 1000
readTimeout
(duration)
Timeout for socket reads. If reached, redis commands will fail with a timeout instead of blocking. Defaults to "3s", "-1" for no timeout.
Example value: 3s
redeliverInterval
(duration)
The interval between checking for pending messages to redelivery. Defaults to "60s". "0" disables redelivery.
Example value: 30s
redisDB
(number)
Database selected after connecting to redis. If "redisType" is "cluster" this option is ignored. Defaults to "0".
Example value: 0
redisMaxRetries
(number)
Maximum number of times to retry commands before giving up. Default is to not retry failed commands.
Example value: 5
redisMaxRetryInterval
(duration)
Maximum backoff for redis commands between each retry. Default is "512ms";"-1" disables backoff.
Example value: 5s
redisMinRetryInterval
(duration)
Minimum backoff for redis commands between each retry. Default is "8ms"; "-1" disables backoff.
Example value: 8ms
redisType
(string)
The type of redis. There are two valid values, one is "node" for single node mode, the other is "cluster" for redis cluster mode. Defaults to "node".
Example value: cluster
sentinelMasterName
(string)
The sentinel master name. See Redis Sentinel Documentation.
Example value: 127.0.0.1:6379
writeTimeout
(duration)
Timeout for socket writes. If reached, redis commands will fail with a timeout instead of blocking. Defaults is readTimeout.
Example value: 3s