From 395431c86c8ebb529d0b902a13e1539495616374 Mon Sep 17 00:00:00 2001 From: inishchith Date: Fri, 15 Aug 2025 13:08:51 -0700 Subject: [PATCH 1/2] feat: add Redis Sentinel support to Redis lock component Enable failover support while maintaining cluster restrictions for distributed lock safety Signed-off-by: inishchith --- .../supported-locks/redis-lock.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md b/daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md index f54ae416b36..1f4b819e7c3 100644 --- a/daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md +++ b/daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md @@ -86,6 +86,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr | maxRetryBackoff | N | Maximum backoff between each retry. Defaults to `2` seconds; `"-1"` disables backoff. | `3000000000` | failover | N | Property to enable failover configuration. Needs sentinelMasterName to be set. The redisHost should be the sentinel host address. See [Redis Sentinel Documentation](https://redis.io/docs/manual/sentinel/). Defaults to `"false"` | `"true"`, `"false"` | sentinelMasterName | N | The sentinel master name. See [Redis Sentinel Documentation](https://redis.io/docs/manual/sentinel/) | `"mymaster"` +| sentinelPassword | N | Password for Redis sentinel. No Default. Can be `secretKeyRef` to use a secret reference | `""`, `"KeFg23!"` | redeliverInterval | N | The interval between checking for pending messages to redelivery. Defaults to `"60s"`. `"0"` disables redelivery. | `"30s"` | processingTimeout | N | The amount time a message must be pending before attempting to redeliver it. Defaults to `"15s"`. `"0"` disables redelivery. | `"30s"` | redisType | N | 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"`. | `"cluster"` @@ -182,6 +183,18 @@ You can use [Helm](https://helm.sh/) to quickly create a Redis instance in our K {{< /tabpane >}} +## Redis Sentinel Behavior + +Use `redisType: "node"` when connecting to Redis Sentinel. Additionally, set `failover` to `"true"` and `sentinelMasterName` to the name of the master node. + +**Failover Characteristics:** +- **Lock Loss During Failover**: Locks may be lost during master failover if they weren't replicated to the promoted replica before the original master failed +- **Failover Window**: Brief unavailability (typically seconds) during automatic master promotion +- **Consistency**: All operations route to the current master, maintaining lock consistency +- **Trade-off**: High availability vs. potential lock loss during failover events + +⚠️ **Important**: Consider your application's tolerance for brief lock loss during failover scenarios. + ## Related links - [Basic schema for a Dapr component]({{% ref component-schema %}}) - [Distributed lock building block]({{% ref distributed-lock-api-overview %}}) From c363cd523b160412ac1d5d9fe344520362dc19dd Mon Sep 17 00:00:00 2001 From: inishchith Date: Tue, 26 Aug 2025 14:59:45 -0700 Subject: [PATCH 2/2] fix: docs based on review comments Signed-off-by: inishchith --- .../supported-locks/redis-lock.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md b/daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md index a2698b06156..3beb290ee9a 100644 --- a/daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md +++ b/daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md @@ -86,7 +86,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr | maxRetryBackoff | N | Maximum backoff between each retry. Defaults to `2` seconds; `"-1"` disables backoff. | `3000000000` | | failover | N | Enable failover configuration. Needs sentinelMasterName to be set. The redisHost should be the sentinel host address. See [Redis Sentinel Documentation](https://redis.io/docs/manual/sentinel/). Defaults to `"false"` | `"true"`, `"false"` | | sentinelMasterName | N | The sentinel master name. See [Redis Sentinel Documentation](https://redis.io/docs/manual/sentinel/) | `"mymaster"` | -| sentinelPassword | N | Password for Redis sentinel. No Default. Can be `secretKeyRef` to use a secret reference | `""`, `"KeFg23!"` +| sentinelPassword | N | Password for Redis Sentinel. No Default. Applicable only when “failover” is true, and Redis Sentinel has authentication enabled | `""`, `"KeFg23!"` | redeliverInterval | N | The interval between checking for pending messages for redelivery. Defaults to `"60s"`. `"0"` disables redelivery. | `"30s"` | | processingTimeout | N | The amount of time a message must be pending before attempting to redeliver it. Defaults to `"15s"`. `"0"` disables redelivery. | `"30s"` | | redisType | N | 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"`. | `"cluster"` | @@ -183,17 +183,18 @@ You can use [Helm](https://helm.sh/) to quickly create a Redis instance in our K {{< /tabpane >}} -## Redis Sentinel Behavior +## Redis Sentinel behavior Use `redisType: "node"` when connecting to Redis Sentinel. Additionally, set `failover` to `"true"` and `sentinelMasterName` to the name of the master node. -**Failover Characteristics:** -- **Lock Loss During Failover**: Locks may be lost during master failover if they weren't replicated to the promoted replica before the original master failed -- **Failover Window**: Brief unavailability (typically seconds) during automatic master promotion -- **Consistency**: All operations route to the current master, maintaining lock consistency -- **Trade-off**: High availability vs. potential lock loss during failover events +Failover characteristics: +- Lock loss during failover: Locks may be lost during master failover if they weren't replicated to the promoted replica before the original master failed +- Failover window: Brief server unavailability (typically seconds) during automatic master promotion +- Consistency: All operations route to the current master, maintaining lock consistency -⚠️ **Important**: Consider your application's tolerance for brief lock loss during failover scenarios. +{{% alert title="Warning" color="warning" %}} +Consider the trade-off of running Redis with high-availability and failover with the potential of lock loss during failover events. Your application should tolerate brief lock loss during failover scenarios. +{{% /alert %}} ## Related links - [Basic schema for a Dapr component]({{% ref component-schema %}})