summaryrefslogtreecommitdiff
path: root/redis/cluster.py
Commit message (Collapse)AuthorAgeFilesLines
* Add support for cluster myshardid (#2704)Anurag Bandyopadhyay2023-05-081-0/+8
| | | | | | | | | | | | | | | | | | | * feat: adding support for cluster myshardid * lint fix * fix: comment fix and async test * fix: adding version check * fix lint: * linters --------- Co-authored-by: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com> Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> Co-authored-by: dvora-h <dvora.heller@redis.com>
* add "address_remap" feature to RedisCluster (#2726)Kristján Valur Jónsson2023-05-021-0/+22
| | | | | | | | | | | | | | | * add cluster "host_port_remap" feature for asyncio.RedisCluster * Add a unittest for asyncio.RedisCluster * Add host_port_remap to _sync_ RedisCluster * add synchronous tests * rename arg to `address_remap` and take and return an address tuple. * Add class documentation * Add CHANGES
* add queue_class to REDIS_ALLOWED_KEYS (#2577)Dongkeun Lee2023-03-161-0/+1
| | | | | | | | | | | | * add queue_class to REDIS_ALLOWED_KEYS * fix lint * fix lint --------- Co-authored-by: zach.lee <zach.lee@sendbird.com> Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* Remove redundant assignment. (#2620)Eom Taegyung "Iggy2023-03-161-1/+0
|
* Fix unlink in cluster pipeline (#2562)gmbnomis2023-01-291-0/+11
| | | | Implement unlink() like delete() to make it work when used in a cluster pipeline.
* add support for custom connection pool class in NodesManager (#2547)Dongkeun Lee2023-01-111-1/+4
| | | Co-authored-by: zach.lee <zach.lee@sendbird.com>
* allow replica to master promotion in nodes_cache (#2549)Dongkeun Lee2023-01-111-0/+2
| | | Co-authored-by: zach.lee <zach.lee@sendbird.com>
* Combine auto-concatenated strings (#2482)David Gilman2022-12-141-2/+2
|
* Add support for certain LATENCY commands (#2503)dvora-h2022-12-141-0/+3
| | | | | * add latency commands * fix tests in cluster
* Added a replacement for the default cluster node in the event of failure. ↵Bar Shaul2022-12-011-2/+43
| | | | (#2463)
* Failover handling improvements for RedisCluster and Async RedisCluster (#2377)Bar Shaul2022-11-101-99/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Cluster&AsyncCluster: Removed handling of timeouts/connection errors within the cluster loop, fixed "cannot pickle '_thread.lock' object" bug, added client's side failover handling improvements * Fixed linters * Type fixes * Added to CHANGES * Added getter and setter for the client's retry object and added more tests * Fixed linters * Fixed test * Fixed test_client_kill test * Changed get_default_backoff to default_backoff, removed retry_on_error and connection_error_retry_attempts from RedisCluster, default retry changed to no retries * Fixing linters * Reverting deletion of connection_error_retry_attempts to maintain backward compatibility * Updating retry object for existing and new connections * Changed the default value of reinitialize_steps from 10 to 5 * fix review comments Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: dvora-h <dvora.heller@redis.com> Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* CredentialsProvider class added to support password rotation (#2261)Bar Shaul2022-11-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * A CredentialsProvider class has been added to allow the user to add his own provider for password rotation * Moved CredentialsProvider to a separate file, added type hints * Changed username and password to properties * Added: StaticCredentialProvider, examples, tests Changed: CredentialsProvider to CredentialProvider Fixed: calling AUTH only with password * Changed private members' prefix to __ * fixed linters * fixed auth test * fixed credential test * Raise an error if username or password are passed along with credential_provider * fixing linters * fixing test * Changed dundered to single per side underscore * Changed Connection class members username and password to properties to enable backward compatibility with changing the members value on existing connection. * Reverting last commit and adding backward compatibility to 'username' and 'password' inside on_connect function * Refactored CredentialProvider class * Fixing tuple type to Tuple * Fixing optional string members in UsernamePasswordCredentialProvider * Fixed credential test * Added credential provider support to AsyncRedis * linters * linters * linters * linters - black Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> Co-authored-by: dvora-h <dvora.heller@redis.com>
* fix docs for password protected socket access (#2378)Robert Hofer2022-11-071-1/+1
| | | Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* ClusterPipeline Doesn't Handle ConnectionError for Dead Hosts (#2225)Greg Melton2022-08-021-25/+44
| | | | | | | | | | | | | | | * adds a retry that forces the nodes_manager to reinitialize if cluster pipleline connect to the one of the mapped nodes * fix line length error * add trailing comma * move appending cmd * updates changes * trigger build * fix linting errors
* Remove python2-only `__nonzero__` method from `cluster.py` (#2313)Nikita Sobolev2022-07-311-4/+0
|
* async_cluster: fix max_connections/ssl & improve args (#2217)Utkarsh Gupta2022-07-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | * async_cluster: fix max_connections/ssl & improve args - set proper connection_class if ssl = True - pass max_connections/connection_class to ClusterNode - recreate startup_nodes to properly initialize - pass parser_class to Connection instead of changing it in on_connect - only pass redis_connect_func if read_from_replicas = True - add connection_error_retry_attempts parameter - skip is_connected check in acquire_connection as it is already checked in send_packed_command BREAKING: - RedisCluster args except host & port are kw-only now - RedisCluster will no longer accept unknown arguments - RedisCluster will no longer accept url as an argument. Use RedisCluster.from_url - RedisCluster.require_full_coverage defaults to True - ClusterNode args except host, port, & server_type are kw-only now * async_cluster: remove kw-only requirement from client Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* Remove verbose logging from `redis-py/redis/cluster.py` (#2238)Nial Daly2022-07-241-56/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | * removed the logging module and its corresponding methods * updated CHANGES * except block for RedisClusterException and BusyLoadingError removed * removed unused import (redis.exceptions.BusyLoadingError) * empty commit to re-trigger Actions workflow * replaced BaseException with Exception * empty commit to re-trigger Actions workflow * empty commit to re-trigger Actions workflow * redundant logic removed * re-trigger pipeline * reverted changes * re-trigger pipeline * except logic changed
* docs: Fix a few typos (#2274)Tim Gates2022-07-241-1/+1
| | | | | | | | | | | | | | | | | * docs: Fix a few typos There are small typos in: - redis/cluster.py - redis/commands/core.py - redis/ocsp.py - tests/test_cluster.py Fixes: - Should read `validity` rather than `valididy`. - Should read `reinitialize` rather than `reinitilize`. - Should read `farthest` rather than `farest`. - Should read `commands` rather than `comamnds`. * Update core.py
* commands/cluster: use pipeline to execute split commands (#2230)Utkarsh Gupta2022-06-271-50/+15
| | | | | | - allow passing target_nodes to pipeline commands - move READ_COMMANDS to commands/cluster to avoid import cycle - add types to list_or_args
* Changed dynamic_startup_nodes default value to 'True' to prevent breaking ↵Bar Shaul2022-06-271-5/+5
| | | | backward compatibility (#2251)
* Added dynamic_startup_nodes configuration to RedisCluster. (#2244)Bar Shaul2022-06-231-2/+15
| | | | | | | | | * Added dynamic_startup_nodes configuration to RedisCluster. By default, uses only the initial passed startup nodes to refresh the cluster topology. If set to true, sets the startup nodes to all of the discovered nodes. * Added RedisCluster specific options to the README file and updated CHANGES * Fixed timeout_error_topology_refresh test Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* Reuse the old nodes' connections when a cluster topology refresh is being ↵Bar Shaul2022-06-231-11/+26
| | | | | | | | | | | | | done (#2235) * A fix was made to reuse the old nodes' connections when a cluster topology refresh is being done * Fixed RedisCluster to immediately raise AuthenticationError * Updated CHANGES * Fixed cluster async bgsave test to ignore "bgsave already in progress" error * Fixed linters
* Made sync lock consistent and added types to it (#2137)Anas2022-06-011-0/+8
| | | | | | | | | * Made sync lock consistent and added types to it * Made linters happy * Fixed cluster client lock signature Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* Fix tests for Redis 7 (#2182)dvora-h2022-05-311-0/+1
| | | | | * fix tests * async
* async_cluster: add pipeline support (#2199)Utkarsh Gupta2022-05-301-36/+78
| | | Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* async_cluster: add/update typing (#2195)Utkarsh Gupta2022-05-301-6/+9
| | | | | | | * async_cluster: add/update typing * async_cluster: update cleanup_kwargs with kwargs from async Connection * async_cluster: properly remove old nodes
* Fix Missing ClusterPipeline Lock (#2190)Greg Melton2022-05-301-0/+5
| | | | | | | | | | | * ClusterPipeline needs to initialize self._lock, otherwise a class instance will fail when calling get_redis_connection on the node * fix bad lint picked up from master * added change to CHANGES file * force ci build again * force ci build again
* Get command keys for subcommands (#2170)dvora-h2022-05-081-0/+1
| | | | | * parse subcommands * fix tests
* Add support for CLUSTER SHARDS (#2151)dvora-h2022-05-081-1/+25
| | | | | | | | | * Add support for CLUSTER SHARDS * linters * add docstring * linters
* Add Async RedisCluster (#2099)Utkarsh Gupta2022-05-081-137/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Copy Cluster Client, Commands, Commands Parser, Tests for asyncio * Async Cluster Tests: Async/Await * Add Async RedisCluster * cluster: use ERRORS_ALLOW_RETRY from self.__class__ * async_cluster: rework redis_connection, initialize, & close - move redis_connection from NodesManager to ClusterNode & handle all related logic in ClusterNode class - use Locks while initializing or closing - in case of error, close connections instead of instantly reinitializing - create ResourceWarning instead of manually deleting client object - use asyncio.gather to run commands/initialize/close in parallel - inline single use functions - fix test_acl_log for py3.6 * async_cluster: add types * async_cluster: add docs * docs: update sphinx & add sphinx_autodoc_typehints * async_cluster: move TargetNodesT to cluster module * async_cluster/commands: inherit commands from sync class if possible * async_cluster: add benchmark script with aredis & aioredis-cluster * async_cluster: remove logging * async_cluster: inline functions * async_cluster: manage Connection instead of Redis Client * async_cluster/commands: optimize parser * async_cluster: use ensure_future & generators for gather * async_conn: optimize * async_cluster: optimize determine_slot * async_cluster: optimize determine_nodes * async_cluster/parser: optimize _get_moveable_keys * async_cluster: inlined check_slots_coverage * async_cluster: update docstrings * async_cluster: add concurrent test & use read_response/_update_moved_slots without lock Co-authored-by: Chayim <chayim@users.noreply.github.com>
* fix execute_command() determine nodes error when no key command (#2097)suxb2012022-04-281-1/+4
|
* [CLUSTER] Fix scan command cursors & Fix scan_iter (#2054)Utkarsh Gupta2022-03-231-6/+10
| | | | | | | * cluster/scan: fix return cursor & change default node to primaries * cluster/scan_iter: fix iteration Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
* Remove verbose logging from cluster initializers (#2055)Joni Nevalainen2022-03-231-4/+0
|
* Add support for SEARCH commands in cluster (#2042)dvora-h2022-03-141-6/+41
| | | | | | | * Add support for SEARCH commands in cluster * delete json tests mark & list search commands * linters
* Add support to use certificates from string in ssl connection (#2048)dvora-h2022-03-141-0/+1
| | | | | | | | | * ssl string cert * fix async test * linters * change test name
* Add support for CLUSTER DELSLOTSRANGE (#2018)dvora-h2022-03-141-0/+2
| | | | | | | | | | | * delslotsrange * test * linters * skip test * linters
* Add support for CLUSTER ADDSLOTSRANGE (#2017)dvora-h2022-03-141-0/+1
| | | | | | | | | | | | | * add cluster addslotsrange * Add support for CLUSTER ADDSLOTSRANGE * docstring * fix test * skip test * linters
* Add cluster support for functions (#2016)dvora-h2022-03-061-0/+13
| | | | | | | | | | | | | | | | | | | * cluster support for functions * fix test_list_on_cluster mark * fix mark * cluster unstable url * fix * fix cluster url * skip tests * linters * linters
* Add support for JSON, TIMESERIES, BLOOM & GRAPH commands in cluster (#2032)dvora-h2022-03-061-1/+29
| | | Co-authored-by: Chayim <chayim@users.noreply.github.com>
* Add support for AUTH (#1929)dogukanteber2022-03-021-0/+1
| | | | | | | | | | | | | * Add support for AUTH * Fix linter error * test fix * fix test in cluster Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: Chayim I. Kirshen <c@kirshen.com> Co-authored-by: dvora-h <dvora.heller@redis.com>
* Implement locks for RedisCluster (#2013)Jake Barnwell2022-03-011-0/+67
| | | | | | | | | | | | | | | | | | | * Add support for .lock() for RedisCluster * Update changelog with lua scripting and lock() changes * Also update asyncio client .lock() doc * Add Python 3.6 back to hash verify CI (#2008) * Renaming chore as maintenance (#2015) * Add AsyncFunctionCommands (#2009) * Also update asyncio client .lock() doc Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com> Co-authored-by: dvora-h <dvora.heller@redis.com>
* Add cluster support for scripting (#1937)Jake Barnwell2022-02-221-18/+69
| | | | | | | | | | | * Add cluster support for scripting * Fall back to connection_pool.get_encoder if necessary * Add documentation for cluster-based scripting * Add test for flush response Co-authored-by: dvora-h <dvora.heller@redis.com>
* FixingElevated CPU utilization on one node when using RedisCluster pipeline ↵Mike Shchurov2022-02-221-5/+3
| | | | (#1985)
* Fix flushdb and flushall (#1926)Meir Shpilraien (Spielrein)2022-02-071-2/+8
| | | | | | | | | | | | | | * Fix flushdb and flushall Both commands should be broadcasted to all the shards. * Support ssl_password on cluster * linter fix * change commands to run only on primary nodes Co-authored-by: Chayim I. Kirshen <c@kirshen.com> Co-authored-by: dvora-h <dvora.heller@redis.com>
* Clusters should optionally require full slot coverage (#1845)Bar Shaul2022-01-101-63/+12
|
* Documentation cleanup (#1841)Chayim2021-12-301-0/+1
|
* Retry on error exception and timeout fixes (#1821)Bar Shaul2021-12-231-52/+49
|
* Fixed MovedError, and stopped iterating through startup nodes when slots are ↵Bar Shaul2021-12-221-2/+12
| | | | fully covered (#1819)
* Added support for MONITOR in clusters (#1756)Bar Shaul2021-12-021-0/+17
|
* Improved RedisCluster's reinitialize_steps and documentation (#1765)Bar Shaul2021-12-021-7/+29
|