Skip to content

Commit baea596

Browse files
DOC-5712 Python SCE API and general intro
1 parent a565152 commit baea596

File tree

3 files changed

+90
-1
lines changed

3 files changed

+90
-1
lines changed

content/develop/clients/patterns/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ description: Novel patterns for working with Redis data structures
1313
linkTitle: Coding patterns
1414
title: Coding patterns
1515
aliases: /develop/use/patterns
16-
weight: 50
16+
weight: 60
1717
---
1818

1919
The following documents describe some novel development patterns you can use with Redis.

content/develop/clients/redis-py/connect.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,46 @@ a simple retry strategy by default, but there are various ways you can customize
252252
this behavior to suit your use case. See
253253
[Retries]({{< relref "/develop/clients/redis-py/produsage#retries" >}})
254254
for more information about custom retry strategies, with example code.
255+
256+
## Connect using Seamless client experience (SCE)
257+
258+
*Seamless client experience (SCE)* is a feature of Redis Cloud and
259+
Redis Enterprise servers that lets them actively notify clients
260+
about planned server maintenance shortly before it happens. This
261+
lets a client take action to avoid disruptions in service.
262+
See [Seamless client experience]({{< relref "/develop/clients/sce" >}})
263+
for more information about SCE.
264+
265+
To enable SCE on the client, pass a `MaintenanceEventsConfig` object
266+
during the connection, as shown in the following example:
267+
268+
```py
269+
import redis
270+
from redis.connection import MaintenanceEventsConfig
271+
from redis.maintenance_events import EndpointType
272+
273+
r = redis.Redis(
274+
decode_responses=True,
275+
protocol=3,
276+
maintenance_events_config= MaintenanceEventsConfig(
277+
enabled=True,
278+
proactive_reconnect=True,
279+
relax_timeout=30,
280+
endpoint_type=EndpointType.INTERNAL_IP,
281+
),
282+
...
283+
)
284+
```
285+
286+
{{< note >}}SCE requires the [RESP3]({{< relref "/develop/reference/protocol-spec#resp-versions" >}})
287+
protocol, so you must set `protocol=3` explicitly when you connect.
288+
{{< /note >}}
289+
290+
The `MaintenanceEventsConfig` constructor accepts the following parameters:
291+
292+
| Name | Type | Default | Description |
293+
|------|------|---------|-------------|
294+
| `enabled` | `bool` | `False` | Whether or not to enable SCE. |
295+
| `proactive_reconnect` | `bool` | `False` | Whether or not to automatically reconnect when a node is replaced. |
296+
| `relax_timeout` | `int` | `20` | The number of seconds to wait before reconnecting after a node replacement. A value of `-1` disables the relax timeout. |
297+
| `endpoint_type` | `EndpointType` | `None` | Override for the endpoint type to use in the `CLIENT MAINT_NOTIFICATIONS` command. If this is `None`, the endpoint type will be determined automatically based on the host and TLS configuration. |

content/develop/clients/sce.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
categories:
3+
- docs
4+
- develop
5+
- stack
6+
- oss
7+
- rs
8+
- rc
9+
- oss
10+
- kubernetes
11+
- clients
12+
description: Learn how to avoid disruptions during Redis server maintenance.
13+
linkTitle: Seamless client experience
14+
title: Seamless client experience
15+
weight: 50
16+
---
17+
18+
*Seamless client experience (SCE)* is a feature of Redis Cloud and
19+
Redis Enterprise servers that lets them actively notify clients
20+
about planned server maintenance shortly before it happens. This
21+
lets a client reconnect or otherwise respond gracefully without significant
22+
interruptions in service.
23+
24+
SCE is primarily useful when server software or hardware is upgraded.
25+
Upgrades tend to impact the general performance of the server, so
26+
advance notification of the upgrade lets a client adjust its command
27+
timeouts to take this into account. Upgrades also involve migrating
28+
Redis shards to new nodes, which inevitably disconnects clients from
29+
existing nodes. However, with some advance warning of the disconnection,
30+
a client can buffer commands, connect to a new node, and then resume
31+
the buffered commands without aborting any of them. As a result, users
32+
see no disruption in service.
33+
34+
## Enable SCE
35+
36+
SCE is enabled by default on Redis Cloud, but you must enable it
37+
explicitly on Redis Enterprise servers.
38+
39+
You must also configure SCE explicitly on the client side during connection.
40+
See the pages linked below to learn how to enable SCE for:
41+
42+
- [redis-py]({{< relref "/develop/clients/redis-py/connect#connect-using-seamless-client-experience-sce" >}})
43+
- [node-redis]({{< relref "/develop/clients/nodejs/connect#connect-using-seamless-client-experience-sce" >}})
44+
- [Jedis]({{< relref "/develop/clients/jedis/connect#connect-using-seamless-client-experience-sce" >}})
45+
- [Lettuce]({{< relref "/develop/clients/lettuce/connect#connect-using-seamless-client-experience-sce" >}})
46+
- [go-redis]({{< relref "/develop/clients/go/ connect#connect-using-seamless-client-experience-sce" >}})

0 commit comments

Comments
 (0)