Initialize a new RedisCluster client. :param startup_nodes: List of nodes from which initial bootstrapping can be done :param host: Can be used to point to a startup node :param port: Can be used to point to a startup node
(
self,
host: Optional[str] = None,
port: int = 6379,
startup_nodes: Optional[List["ClusterNode"]] = None,
cluster_error_retry_attempts: int = DEFAULT_RETRY_COUNT,
retry: Optional["Retry"] = None,
require_full_coverage: bool = True,
reinitialize_steps: int = 5,
read_from_replicas: bool = False,
load_balancing_strategy: Optional["LoadBalancingStrategy"] = None,
dynamic_startup_nodes: bool = True,
url: Optional[str] = None,
address_remap: Optional[Callable[[Tuple[str, int]], Tuple[str, int]]] = None,
cache: Optional[CacheInterface] = None,
cache_config: Optional[CacheConfig] = None,
event_dispatcher: Optional[EventDispatcher] = None,
policy_resolver: PolicyResolver = StaticPolicyResolver(),
maint_notifications_config: Optional[MaintNotificationsConfig] = None,
**kwargs,
)
| 698 | version="6.0.0", |
| 699 | ) |
| 700 | def __init__( |
| 701 | self, |
| 702 | host: Optional[str] = None, |
| 703 | port: int = 6379, |
| 704 | startup_nodes: Optional[List["ClusterNode"]] = None, |
| 705 | cluster_error_retry_attempts: int = DEFAULT_RETRY_COUNT, |
| 706 | retry: Optional["Retry"] = None, |
| 707 | require_full_coverage: bool = True, |
| 708 | reinitialize_steps: int = 5, |
| 709 | read_from_replicas: bool = False, |
| 710 | load_balancing_strategy: Optional["LoadBalancingStrategy"] = None, |
| 711 | dynamic_startup_nodes: bool = True, |
| 712 | url: Optional[str] = None, |
| 713 | address_remap: Optional[Callable[[Tuple[str, int]], Tuple[str, int]]] = None, |
| 714 | cache: Optional[CacheInterface] = None, |
| 715 | cache_config: Optional[CacheConfig] = None, |
| 716 | event_dispatcher: Optional[EventDispatcher] = None, |
| 717 | policy_resolver: PolicyResolver = StaticPolicyResolver(), |
| 718 | maint_notifications_config: Optional[MaintNotificationsConfig] = None, |
| 719 | **kwargs, |
| 720 | ): |
| 721 | """ |
| 722 | Initialize a new RedisCluster client. |
| 723 | |
| 724 | :param startup_nodes: |
| 725 | List of nodes from which initial bootstrapping can be done |
| 726 | :param host: |
| 727 | Can be used to point to a startup node |
| 728 | :param port: |
| 729 | Can be used to point to a startup node |
| 730 | :param require_full_coverage: |
| 731 | When set to False (default value): the client will not require a |
| 732 | full coverage of the slots. However, if not all slots are covered, |
| 733 | and at least one node has 'cluster-require-full-coverage' set to |
| 734 | 'yes,' the server will throw a ClusterDownError for some key-based |
| 735 | commands. See - |
| 736 | https://redis.io/topics/cluster-tutorial#redis-cluster-configuration-parameters |
| 737 | When set to True: all slots must be covered to construct the |
| 738 | cluster client. If not all slots are covered, RedisClusterException |
| 739 | will be thrown. |
| 740 | :param read_from_replicas: |
| 741 | @deprecated - please use load_balancing_strategy instead |
| 742 | Enable read from replicas in READONLY mode. You can read possibly |
| 743 | stale data. |
| 744 | When set to true, read commands will be assigned between the |
| 745 | primary and its replications in a Round-Robin manner. |
| 746 | :param load_balancing_strategy: |
| 747 | Enable read from replicas in READONLY mode and defines the load balancing |
| 748 | strategy that will be used for cluster node selection. |
| 749 | The data read from replicas is eventually consistent with the data in primary nodes. |
| 750 | :param dynamic_startup_nodes: |
| 751 | Set the RedisCluster's startup nodes to all of the discovered nodes. |
| 752 | If true (default value), the cluster's discovered nodes will be used to |
| 753 | determine the cluster nodes-slots mapping in the next topology refresh. |
| 754 | It will remove the initial passed startup nodes if their endpoints aren't |
| 755 | listed in the CLUSTER SLOTS output. |
| 756 | If you use dynamic DNS endpoints for startup nodes but CLUSTER SLOTS lists |
| 757 | specific IP addresses, it is best to set it to false. |
nothing calls this directly
no test coverage detected