Skip to main content

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:
# 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"
# Password for Redis host. No Default. Can be "secretKeyRef" to use a secret reference
- name: redisPassword
value: "KeFg23!"
# 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"
# 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: "default"
# 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"

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

redisPassword (string)

Required - Password for Redis host. No Default. Can be "secretKeyRef" to use a secret reference

Example value: KeFg23!

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

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: default

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