You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{< note >}}SCH requires the [RESP3]({{< relref "/develop/reference/protocol-spec#resp-versions" >}})
158
+
protocol, so you must set `Protocol:3` explicitly when you connect.
159
+
{{< /note >}}
160
+
161
+
The `maintnotifications.Config` object accepts the following parameters:
162
+
163
+
| Name | Description |
164
+
|------ |------------- |
165
+
|`Mode`| Whether or not to enable SCH. The options are `ModeDisabled`, `ModeEnabled` (require SCH and abort the connection if not supported), and `ModeAuto` (require SCH and fall back to a non-SCH connection if not supported). The default is `ModeAuto`. |
166
+
|`EndpointType`| The type of endpoint to use for the connection. The options are `EndpointTypeExternalIP`, `EndpointTypeInternalIP`, `EndpointTypeExternalFQDN`, `EndpointTypeInternalFQDN`, `EndpointTypeAuto` (auto-detect based on connection), and `EndpointTypeNone` (reconnect with current config). The default is `EndpointTypeExternalIP`. |
167
+
|`HandoffTimeout`| The timeout to connect to the replacement node. The default is 15 seconds. |
168
+
|`RelaxedTimeout`| The timeout to use for commands and connections while the server is performing maintenance. The default is 10 seconds. |
169
+
|`PostHandoffRelaxedDuration`| The duration to continue using relaxed timeouts after a successful handoff (this provides extra resilience during cluster transitions). The default is 20 seconds. |
170
+
|`MaxHandoffRetries`| The maximum number of times to retry connecting to the replacement node. The default is 3. |
Copy file name to clipboardExpand all lines: content/develop/clients/lettuce/connect.md
+71Lines changed: 71 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -254,3 +254,74 @@ public class Pool {
254
254
```
255
255
256
256
In this setup, `LettuceConnectionFactory` is a custom class you would need to implement, adhering to Apache Commons Pool's `PooledObjectFactory` interface, to manage lifecycle events of pooled `StatefulRedisConnection` objects.
257
+
258
+
## Connect using Smart client handoffs (SCH)
259
+
260
+
*Smart client handoffs (SCH)* is a feature of Redis Cloud and
261
+
Redis Enterprise servers that lets them actively notify clients
262
+
about planned server maintenance shortly before it happens. This
263
+
lets a client take action to avoid disruptions in service.
264
+
See [Smart client handoffs]({{< relref "/develop/clients/sch" >}})
265
+
for more information about SCH.
266
+
267
+
To enable SCH on the client, create a `MaintNotificationsConfig` object
268
+
and/or a `TimeoutOptions` object
269
+
and pass them to the `ClientOptions` builder as shown in the example below:
The `MaintNotificationsConfig` builder accepts the following options:
314
+
315
+
| Method | Description |
316
+
|--------|-------------|
317
+
|`enableMaintNotifications()`| Enable SCH. |
318
+
|`endpointType(EndpointType type)`| Set the type of endpoint to use for the connection. The options are `EndpointType.EXTERNAL_IP`, `EndpointType.INTERNAL_IP`, `EndpointType.EXTERNAL_FQDN`, `EndpointType.INTERNAL_FQDN`, and `EndpointType.NONE`. Use the separate `autoResolveEndpointType()` method to auto-detect based on the connection (this is the default behavior). |
319
+
|`autoResolveEndpointType()`| Auto-detect the type of endpoint to use for the connection. This is the default behavior. Use `endpointType()` to set a specific endpoint type. |
320
+
321
+
Among other options, the `TimeoutOptions` builder accepts the following option
322
+
that is relevant to SCH:
323
+
324
+
| Method | Description |
325
+
|--------|-------------|
326
+
|`relaxedTimeoutsDuringMaintenance(Duration duration)`| Set the timeout to use while the server is performing maintenance. The default is 10 seconds. |
Copy file name to clipboardExpand all lines: content/develop/clients/nodejs/connect.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -329,6 +329,51 @@ createClient({
329
329
});
330
330
```
331
331
332
+
## Connect using Smart client handoffs (SCH)
333
+
334
+
*Smart client handoffs (SCH)* is a feature of Redis Cloud and
335
+
Redis Enterprise servers that lets them actively notify clients
336
+
about planned server maintenance shortly before it happens. This
337
+
lets a client take action to avoid disruptions in service.
338
+
See [Smart client handoffs]({{< relref "/develop/clients/sch" >}})
339
+
for more information about SCH.
340
+
341
+
Use the configuration options shown in the example below to enable SCH
342
+
during the connection:
343
+
344
+
```js
345
+
constclient=createClient({
346
+
RESP:3,
347
+
maintNotifications:'auto',
348
+
maintEndpointType:'auto',
349
+
maintRelaxedCommandTimeout:10000,
350
+
maintRelaxedSocketTimeout:10000,
351
+
...
352
+
});
353
+
```
354
+
355
+
{{< note >}}SCH requires the [RESP3]({{< relref "/develop/reference/protocol-spec#resp-versions" >}})
356
+
protocol, so you must set the `RESP:3` option explicitly when you connect.
357
+
{{< /note >}}
358
+
359
+
The available options are:
360
+
361
+
-`maintNotifications`: (`string`) Whether or not to enable SCH. The options are
362
+
-`'disabled'`: don't use SCH
363
+
-`'enabled'`: attempt to activate SCH on the server and abort the connection if it isn't supported
364
+
-`'auto'`: attempt to activate SCH on the server and fall back to a non-SCH
365
+
connection if it isn't supported. This is the default.
366
+
-`maintEndpointType`: (`MovingEndpointType`) The type of endpoint to use for the connection. The options are:
367
+
-`'external-ip'`: use the external IP address of the server
368
+
-`'internal-ip'`: use the internal IP address of the server
369
+
-`'external-fqdn'`: use the external FQDN of the server
370
+
-`'internal-fqdn'`: use the internal FQDN of the server
371
+
-`'auto'`: auto-detect based on connection. This is the default.
372
+
-`maintRelaxedCommandTimeout`: (`number`) The command timeout to use while the server is
373
+
performing maintenance. The default is 10000 (10 seconds). If a timeout happens during the maintenance period, the client receives a `CommandTimeoutDuringMaintenance` error.
374
+
-`maintRelaxedSocketTimeout`: (`number`) The socket timeout to use while the server is
375
+
performing maintenance. The default is 10000 (10 seconds). If a timeout happens during the maintenance period, the client receives a `SocketTimeoutDuringMaintenance` error.
{{< note >}}SCH requires the [RESP3]({{< relref "/develop/reference/protocol-spec#resp-versions" >}})
286
+
protocol, so you must set `protocol=3` explicitly when you connect.
287
+
{{< /note >}}
288
+
289
+
The `MaintNotificationsConfig` constructor accepts the following parameters:
290
+
291
+
| Name | Type | Default | Description |
292
+
|------|------|---------|-------------|
293
+
|`enabled`|`bool`|`False`| Whether or not to enable SCH. |
294
+
|`proactive_reconnect`|`bool`|`True`| Whether or not to automatically reconnect when a node is replaced. |
295
+
|`endpoint_type`|`EndpointType`| Auto-detect | The type of endpoint to use for the connection. The options are `EndpointType.EXTERNAL_IP`, `EndpointType.INTERNAL_IP`, `EndpointType.EXTERNAL_FQDN`, `EndpointType.INTERNAL_FQDN`, and `EndpointType.NONE`. |
296
+
|`relaxed_timeout`|`int`|`20`| The timeout (in seconds) to use while the server is performing maintenance. A value of `-1` disables the relax timeout and just uses the normal timeout during maintenance. |
0 commit comments