Skip to main content

Redis

Type: bindings.redis

Status: stable

Reference: https://docs.dapr.io/reference/components-reference/supported-bindings/redis/

Example

apiVersion: cra.diagrid.io/v1beta1
kind: Component
metadata:
name: <name>
spec:
type: bindings.redis
version: v1
metadata:
# Password for Redis host. 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
- 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: |
#
# Dial timeout for establishing new connections. (Optional)
#- name: dialTimeout
# value: "5s"
# If the Redis instance supports TLS; can be configured to be enabled or disabled. (Optional)
#- name: enableTLS
# value: "false"
# Enables failover configuration. It requires "sentinelMasterName" to be set, and "redisHost" to be the sentinel host address. (Optional)
#- name: failover
# value: "false"
# Frequency of idle checks made by idle connections reaper. "-1" disables idle connections reaper. (Optional)
#- name: idleCheckFrequency
# value: "1m"
# Amount of time after which the client closes idle connections. Should be less than server's timeout. "-1" disables idle timeout check. (Optional)
#- name: idleTimeout
# value: "5m"
# Connection age at which the client retires (closes) the connection. Default is to not close aged connections. (Optional)
#- name: maxConnAge
# value: "30m"
# Minimum number of idle connections to keep open in order to avoid the performance degradation associated with creating new connections. (Optional)
#- name: minIdleConns
# value: "0"
# 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"
# Timeout for socket reads. If reached, Redis commands will fail with a timeout instead of blocking. Use "-1" for no timeout. (Optional)
#- name: readTimeout
# value: "3s"
# Database selected after connecting to Redis. If "redisType" is "cluster" this option is ignored. (Optional)
#- name: redisDB
# value: "0"
# Maximum number of retries before giving up. (Optional)
#- name: redisMaxRetries
# value: "3"
# Maximum backoff for Redis commands between each retry. "-1" disables backoff. (Optional)
#- name: redisMaxRetryInterval
# value: "512ms"
# Minimum backoff for Redis commands between each retry. "-1" disables backoff. (Optional)
#- name: redisMinRetryInterval
# value: "8ms"
# Redis service type. Set to "node" for single-node mode, or "cluster" for Redis Cluster. (Optional)
#- name: redisType
# value: "node"
# The Redis sentinel master name. Required when "failover" is enabled. (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 to "readTimeout". (Optional)
#- name: writeTimeout
# value: "3s"

Binding information

Input Binding: no

Output Binding: yes

Output Binding operations:

  • create: Create item

  • get: Get item

  • delete: Delete item

  • increment: Increment a key

Authentication profiles

Available authentication profiles:

  • Username and password

Username and password

Authenticate using username and password

redisPassword (string)

Password for Redis host. 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

Metadata

redisHost (string)

Required - Connection-string for the Redis 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

dialTimeout (duration)

Dial timeout for establishing new connections.

Default value: 5s

Example value: 10s

enableTLS (bool)

If the Redis instance supports TLS; can be configured to be enabled or disabled.

Default value: false

Example value: true

failover (bool)

Enables failover configuration. It requires "sentinelMasterName" to be set, and "redisHost" to be the sentinel host address.

Default value: false

Example value: true

Redis Sentinel documentation: https://redis.io/docs/manual/sentinel/

idleCheckFrequency (duration)

Frequency of idle checks made by idle connections reaper. "-1" disables idle connections reaper.

Default value: 1m

Example value: -1

idleTimeout (duration)

Amount of time after which the client closes idle connections. Should be less than server's timeout. "-1" disables idle timeout check.

Default value: 5m

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

minIdleConns (number)

Minimum number of idle connections to keep open in order to avoid the performance degradation associated with creating new connections.

Default value: 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

readTimeout (duration)

Timeout for socket reads. If reached, Redis commands will fail with a timeout instead of blocking. Use "-1" for no timeout.

Default value: 3s

Example value: 10s

redisDB (number)

Database selected after connecting to Redis. If "redisType" is "cluster" this option is ignored.

Default value: 0

Example value: 0

redisMaxRetries (number)

Maximum number of retries before giving up.

Default value: 3

Example value: 5

redisMaxRetryInterval (duration)

Maximum backoff for Redis commands between each retry. "-1" disables backoff.

Default value: 512ms

Example value: -1

redisMinRetryInterval (duration)

Minimum backoff for Redis commands between each retry. "-1" disables backoff.

Default value: 8ms

Example value: -1

redisType (string)

Redis service type. Set to "node" for single-node mode, or "cluster" for Redis Cluster.

Default value: node

Example value: cluster

Allowed values:

  • node

  • cluster

sentinelMasterName (string)

The Redis sentinel master name. Required when "failover" is enabled.

Example value: 127.0.0.1:6379

Redis Sentinel documentation: https://redis.io/docs/manual/sentinel/

writeTimeout (duration)

Timeout for socket writes. If reached, Redis commands will fail with a timeout instead of blocking. Defaults to "readTimeout".

Example value: 3s