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
Retry behaviour in Redis Cluster is a little bit different from Standalone:
50
50
51
-
* ``retry``: :class:`~.Retry` instance with a :ref:`backoff-label` strategy and the max number of retries, default value is ``Retry(NoBackoff(), 0)``
52
-
* ``cluster_error_retry_attempts``: number of times to retry before raising an error when :class:`~.TimeoutError` or :class:`~.ConnectionError` or :class:`~.ClusterDownError` are encountered, default value is ``3``
51
+
* ``retry``: :class:`~.Retry` instance with a :ref:`backoff-label` strategy and the max number of retries, default value is ``Retry(ExponentialWithJitterBackoff(base=1, cap=10), cluster_error_retry_attempts)``
52
+
* ``cluster_error_retry_attempts``: number of times to retry before raising an error when :class:`~.TimeoutError` or :class:`~.ConnectionError` or :class:`~.ClusterDownError` or :class:`~.SlotNotCoveredError` are encountered, default value is ``3``
53
+
* This argument is deprecated - it is used to initialize the number of retries for the retry object,
54
+
only in the case when the ``retry`` object is not provided.
55
+
When the ``retry`` argument is provided, the ``cluster_error_retry_attempts`` argument is ignored!
56
+
57
+
* Starting from version 6.0.0 of the library, the default retry policy for the nodes connections is without retries.
58
+
This means that if a connection to a node fails, the lower level connection will not retry the connection.
59
+
Instead, it will raise a :class:`~.ConnectionError` to the cluster level call., where it will be retried.
60
+
This is done to avoid blocking the cluster client for too long in case of a node failure.
61
+
62
+
* The retry object is not yet fully utilized in the cluster client.
63
+
The retry object is used only to determine the number of retries for the cluster level calls.
#. the client library calculates the hash slot for key 'foo'.
64
75
#. given the hash slot, it then determines which node to connect to, in order to execute the command.
65
76
#. during the connection, a :class:`~.ConnectionError` is raised.
66
-
#. because we set ``retry=Retry(ExponentialBackoff(), 6)``, the client tries to reconnect to the node up to 6 times, with an exponential backoff between each attempt.
67
-
#. even after 6 retries, the client is still unable to connect.
68
-
#. because we set ``cluster_error_retry_attempts=1``, before giving up, the client starts a cluster update, removes the failed node from the startup nodes, and re-initializes the cluster.
69
-
#. after the cluster has been re-initialized, it starts a new cycle of retries, up to 6 retries, with an exponential backoff.
70
-
#. if the client can connect, we're good. Otherwise, the exception is finally raised to the caller, because we've run out of attempts.
77
+
#. because the default retry policy for the nodes connections is without retries, the error is raised to the cluster level call
78
+
#. because we set ``retry=Retry(ExponentialBackoff(), 6)``, the cluster client starts a cluster update, removes the failed node from the startup nodes, and re-initializes the cluster.
79
+
#. the cluster client retries the command until it either succeeds or the max number of retries is reached.
0 commit comments