Skip to content

Commit bcc63fb

Browse files
authored
Merge pull request #4948 from MyMirelHub/redis-sentinel-multiple-addresses
Add Redis Sentinel configuration details to pubsub component document…
2 parents 0c53415 + 902d229 commit bcc63fb

File tree

5 files changed

+106
-14
lines changed

5 files changed

+106
-14
lines changed

daprdocs/content/en/reference/components-reference/supported-bindings/redis.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ The above example uses secrets as plain strings. It is recommended to use a secr
3838
3939
| Field | Required | Binding support | Details | Example |
4040
|--------------------|:--------:|------------|-----|---------|
41-
| `redisHost` | Y | Output | The Redis host address | `"localhost:6379"` |
41+
| `redisHost` | Y | Output | Connection-string for the redis host. If `"redisType"` is `"cluster"`, it can be multiple hosts separated by commas or just a single host. When using Redis Sentinel (`"failover"` is `"true"`), multiple sentinel addresses can also be provided as comma-separated values. | `localhost:6379`, `redis-master.default.svc.cluster.local:6379`, `sentinel1:26379,sentinel2:26379,sentinel3:26379` |
4242
| `redisPassword` | N | Output | The Redis password | `"password"` |
4343
| `redisUsername` | N | Output | Username for Redis host. Defaults to empty. Make sure your redis server version is 6 or above, and have created acl rule correctly. | `"username"` |
4444
| `useEntraID` | N | Output | Implements EntraID support for Azure Cache for Redis. Before enabling this: <ul><li>The `redisHost` name must be specified in the form of `"server:port"`</li><li>TLS must be enabled</li></ul> Learn more about this setting under [Create a Redis instance > Azure Cache for Redis]({{% ref "#create-a-redis-instance" %}}) | `"true"`, `"false"` |
4545
| `enableTLS` | N | Output | If the Redis instance supports TLS with public certificates it can be configured to enable or disable TLS. Defaults to `"false"` | `"true"`, `"false"` |
4646
| `clientCert` | N | Output | The content of the client certificate, used for Redis instances that require client-side certificates. Must be used with `clientKey` and `enableTLS` must be set to true. It is recommended to use a secret store as described [here]({{% ref component-secrets.md %}}) | `"----BEGIN CERTIFICATE-----\nMIIC..."` |
4747
| `clientKey` | N | Output | The content of the client private key, used in conjunction with `clientCert` for authentication. It is recommended to use a secret store as described [here]({{% ref component-secrets.md %}}) | `"----BEGIN PRIVATE KEY-----\nMIIE..."` |
48-
| `failover` | N | Output | Property to enable failover configuration. Needs sentinelMasterName to be set. Defaults to `"false"` | `"true"`, `"false"`
48+
| `failover` | N | Output | Property to enable failover configuration. Needs sentinelMasterName to be set. When enabled, redisHost should contain the sentinel addresses. Defaults to `"false"` | `"true"`, `"false"`
4949
| `sentinelMasterName` | N | Output | The sentinel master name. See [Redis Sentinel Documentation](https://redis.io/docs/reference/sentinel-clients/) | `""`, `"mymaster"`
5050
| `sentinelUsername` | N | Output | Username for Redis Sentinel. Applicable only when "failover" is true, and Redis Sentinel has authentication enabled | `"username"`
5151
| `sentinelPassword` | N | Output | Password for Redis Sentinel. Applicable only when "failover" is true, and Redis Sentinel has authentication enabled | `"password"`
@@ -249,6 +249,28 @@ You can use [Helm](https://helm.sh/) to quickly create a Redis instance in our K
249249
The Dapr CLI automatically deploys a local redis instance in self hosted mode as part of the `dapr init` command.
250250
{{% /alert %}}
251251

252+
## Redis Sentinel configuration
253+
254+
When using Redis Sentinel for high availability, set `redisType` to `"node"`, enable failover mode with `failover: "true"`, and provide the sentinel master name. Multiple sentinel addresses can be specified as a comma-separated list in the `redisHost` field for redundancy.
255+
256+
```yaml
257+
apiVersion: dapr.io/v1alpha1
258+
kind: Component
259+
metadata:
260+
name: redis-pubsub
261+
spec:
262+
type: pubsub.redis
263+
version: v1
264+
metadata:
265+
- name: redisHost
266+
value: "sentinel1:26379,sentinel2:26379,sentinel3:26379"
267+
- name: redisType
268+
value: "node"
269+
- name: failover
270+
value: "true"
271+
- name: sentinelMasterName
272+
value: "mymaster"
273+
```
252274

253275
## Related links
254276

daprdocs/content/en/reference/components-reference/supported-configuration-stores/redis-configuration-store.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ The above example uses secrets as plain strings. It is recommended to use a secr
3939
4040
| Field | Required | Details | Example |
4141
|--------------------|:--------:|---------|---------|
42-
| redisHost | Y | Output | The Redis host address | `"localhost:6379"` |
42+
| redisHost | Y | Output | Connection-string for the redis host. If `"redisType"` is `"cluster"`, it can be multiple hosts separated by commas or just a single host. When using Redis Sentinel (`"failover"` is `"true"`), multiple sentinel addresses can also be provided as comma-separated values. | `localhost:6379`, `redis-master.default.svc.cluster.local:6379`, `sentinel1:26379,sentinel2:26379,sentinel3:26379` |
4343
| redisPassword | N | Output | The Redis password | `"password"` |
4444
| redisUsername | N | Output | Username for Redis host. Defaults to empty. Make sure your Redis server version is 6 or above, and have created acl rule correctly. | `"username"` |
4545
| enableTLS | N | Output | If the Redis instance supports TLS with public certificates it can be configured to enable or disable TLS. Defaults to `"false"` | `"true"`, `"false"` |
4646
| clientCert | N | Output | The content of the client certificate, used for Redis instances that require client-side certificates. Must be used with `clientKey` and `enableTLS` must be set to true. It is recommended to use a secret store as described [here]({{% ref component-secrets.md %}}) | `"----BEGIN CERTIFICATE-----\nMIIC..."` |
4747
| clientKey | N | Output | The content of the client private key, used in conjunction with `clientCert` for authentication. It is recommended to use a secret store as described [here]({{% ref component-secrets.md %}}) | `"----BEGIN PRIVATE KEY-----\nMIIE..."` |
48-
| failover | N | Output | Property to enable failover configuration. Needs sentinelMasterName to be set. Defaults to `"false"` | `"true"`, `"false"`
48+
| failover | N | Output | Property to enable failover configuration. Needs sentinelMasterName to be set. When enabled, redisHost should contain the sentinel addresses. Defaults to `"false"` | `"true"`, `"false"`
4949
| sentinelMasterName | N | Output | The Sentinel master name. See [Redis Sentinel Documentation](https://redis.io/docs/reference/sentinel-clients/) | `""`, `"mymaster"`
5050
| sentinelUsername | N | Output | Username for Redis Sentinel. Applicable only when "failover" is true, and Redis Sentinel has authentication enabled | `"username"`
5151
| sentinelPassword | N | Output | Password for Redis Sentinel. Applicable only when "failover" is true, and Redis Sentinel has authentication enabled | `"password"`
@@ -143,6 +143,29 @@ You can use [Helm](https://helm.sh/) to quickly create a Redis instance in our K
143143

144144
{{< /tabpane >}}
145145

146+
## Redis Sentinel configuration
147+
148+
When using Redis Sentinel for high availability, set `redisType` to `"node"`, enable failover mode with `failover: "true"`, and provide the sentinel master name. Multiple sentinel addresses can be specified as a comma-separated list in the `redisHost` field for redundancy.
149+
150+
```yaml
151+
apiVersion: dapr.io/v1alpha1
152+
kind: Component
153+
metadata:
154+
name: redis-pubsub
155+
spec:
156+
type: pubsub.redis
157+
version: v1
158+
metadata:
159+
- name: redisHost
160+
value: "sentinel1:26379,sentinel2:26379,sentinel3:26379"
161+
- name: redisType
162+
value: "node"
163+
- name: failover
164+
value: "true"
165+
- name: sentinelMasterName
166+
value: "mymaster"
167+
```
168+
146169
## Related links
147170
- [Basic schema for a Dapr component]({{% ref component-schema %}})
148171
- Read [How-To: Manage configuration from a store]({{% ref "howto-manage-configuration" %}}) for instructions on how to use Redis as a configuration store.

daprdocs/content/en/reference/components-reference/supported-locks/redis-lock.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ The above example uses secrets as plain strings. It is recommended to use a secr
7777
7878
| Field | Required | Details | Example |
7979
|-----------------------|:--------:|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
80-
| redisHost | Y | Connection string for the redis host | `localhost:6379`, `redis-master.default.svc.cluster.local:6379` |
80+
| redisHost | Y | Connection-string for the redis host. If `"redisType"` is `"cluster"`, it can be multiple hosts separated by commas or just a single host. When using Redis Sentinel (`"failover"` is `"true"`), multiple sentinel addresses can also be provided as comma-separated values. | `localhost:6379`, `redis-master.default.svc.cluster.local:6379`, `sentinel1:26379,sentinel2:26379,sentinel3:26379` host | `localhost:6379`, `redis-master.default.svc.cluster.local:6379` |
8181
| redisPassword | N | Password for Redis host. No Default. Can be `secretKeyRef` to use a secret reference | `""`, `"KeFg23!"` |
8282
| redisUsername | N | Username for Redis host. Defaults to empty. Make sure your redis server version is 6 or above, and have created acl rule correctly. | `""`, `"default"` |
8383
| useEntraID | N | Implements EntraID support for Azure Cache for Redis. Before enabling this: <ul><li>The `redisHost` name must be specified in the form of `"server:port"`</li><li>TLS must be enabled</li></ul> Learn more about this setting under [Create a Redis instance > Azure Cache for Redis]({{% ref "#setup-redis" %}}) | `"true"`, `"false"` |
8484
| enableTLS | N | If the Redis instance supports TLS with public certificates, can be configured to be enabled or disabled. Defaults to `"false"` | `"true"`, `"false"` |
8585
| maxRetries | N | Maximum number of retries before giving up. Defaults to `3` | `5`, `10` |
8686
| maxRetryBackoff | N | Maximum backoff between each retry. Defaults to `2` seconds; `"-1"` disables backoff. | `3000000000` |
87-
| 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"` |
88-
| sentinelMasterName | N | The sentinel master name. See [Redis Sentinel Documentation](https://redis.io/docs/manual/sentinel/) | `"mymaster"` |
87+
| failover | N | Property to enable failover configuration. Needs sentinelMasterName to be set. When enabled, redisHost should contain the sentinel addresses. Defaults to `"false"` | `"true"`, `"false"` |
88+
| sentinelMasterName | N | The sentinel master name. See [Redis Sentinel Documentation](https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/) | `"mymaster"` |
8989
| sentinelPassword | N | Password for Redis Sentinel. No Default. Applicable only when “failover” is true, and Redis Sentinel has authentication enabled | `""`, `"KeFg23!"`
9090
| redeliverInterval | N | The interval between checking for pending messages for redelivery. Defaults to `"60s"`. `"0"` disables redelivery. | `"30s"` |
9191
| processingTimeout | N | The amount of time a message must be pending before attempting to redeliver it. Defaults to `"15s"`. `"0"` disables redelivery. | `"30s"` |
@@ -185,7 +185,7 @@ You can use [Helm](https://helm.sh/) to quickly create a Redis instance in our K
185185

186186
## Redis Sentinel behavior
187187

188-
Use `redisType: "node"` when connecting to Redis Sentinel. Additionally, set `failover` to `"true"` and `sentinelMasterName` to the name of the master node.
188+
Use `redisType: "node"` when connecting to Redis Sentinel. Additionally, set `failover` to `"true"` and `sentinelMasterName` to the name of the master node. Multiple sentinel addresses can be specified as a comma-separated list in the `redisHost` field for redundancy.
189189

190190
Failover characteristics:
191191
- 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

0 commit comments

Comments
 (0)