
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Redis Cluster support for aioredis (support only v1.x.x).
Many implementation features were inspired by go-redis project.
mget
/mset
must provide one key slot.
# works
await redis.mget("key1:{foo}", "key2:{foo}")
# throw RedisClusterError
await redis.mget("key1", "key2")
Redis
methods below do not works and not supported in cluster mode implementation.
cluster_add_slots
cluster_count_failure_reports
cluster_count_key_in_slots
cluster_del_slots
cluster_failover
cluster_forget
cluster_get_keys_in_slots
cluster_meet
cluster_replicate
cluster_reset
cluster_save_config
cluster_set_config_epoch
cluster_setslot
cluster_readonly
cluster_readwrite
client_setname
shutdown
slaveof
script_kill
move
select
flushall
flushdb
script_load
script_flush
script_exists
scan
iscan
quit
swapdb
migrate
migrate_keys
wait
bgrewriteaof
bgsave
config_rewrite
config_set
config_resetstat
save
sync
pipeline
multi_exec
But you can always execute command you need on concrete node on cluster with usual aioredis.RedisConnection
, aioredis.ConnectionsPool
or high-level aioredis.Redis
interfaces.
pip install aioredis-cluster
import aioredis_cluster
redis = await aioredis_cluster.create_redis_cluster([
"redis://redis-cluster-node1",
])
# or
redis = await aioredis_cluster.create_redis_cluster([
"redis://redis-cluster-node1",
"redis://redis-cluster-node2",
"redis://redis-cluster-node3",
])
# or
redis = await aioredis_cluster.create_redis_cluster([
("redis-cluster-node1", 6379),
])
await redis.set("key", "value", expire=180)
redis.close()
await redis.wait_closed()
The aioredis_cluster is offered under MIT license.
Rework PubSub and fix race conditions (#27)
aioredis_cluster.aioredis.stream
moduleRedisConnection
implementation for clusterRedisConnection
once entered in PubSub mode was never exit in them, because is too hard handle spontaneously unsubscribe events from Redis with simultaneously (P|S)UNSUBSCRIBE
manually callsCluster
, RedisConnection
and ConnectionsPool
in_pubsub
indicates flag when connector have in pubsub mode connections instead number of PUB/SUB channelsRedisConnection
aioredis
testsaioredis.Connection
socket reader routine for sharded PUB/SUB when cluster reshard and Redis starts respond MOVED
error on SSUBSCRIBE
commands #24spublish
, ssubscribe
, sunsubscribe
, pubsub_shardchannels
, pubsub_shardnumsub
, sharded_pubsub_channels
state_reload_frequency
option from create_cluster
factory was removedusername
argument for pool creationAUTH
command with usernamecreate_cluster
, create_redis_cluster
, aioredis_cluster.aioredis.create_connection
now support username
argumentauth_with_username
method for AbcConnection
, AbcPool
and impementationsasyncio.CancelledError
db
argument for pool/connection in cluster modeTask was destroyed but it is pending!
message in logConnectionsPool.acquire()
is stuck because closed PUB/SUB connection is not cleanup from used
setConnectionsPool.acquire()
incorrect wakeup order for connection waiters when connection is releasedConnectionsPool.execute()
now acquire dedicate connection for execution if command is blocking, ex. BLPOP
ConnectionsPool.execute()
now raises ValueError
exception for PUB/SUB family commandConnectionsPool
PUB/SUB dedicated connections now is closing on close()
callaioredis_cluster.abc.AbcConnection
abstract classreadonly
and method set_readonly()
for aioredis_cluster.abc.AbcConnection
and aioredis_cluster.abc.AbcPool
aioredis_cluster.Cluster
now require pool_cls
implementation from aioredis_cluster.abc.AbcPool
ssl
argument for factories create_cluster
, create_redis_cluster
and Cluster
constructorselect()
, auth()
methods for ConnectionsPool
aioredis==1.3.1
source code into aioredis_cluster._aioredis
and introduce aioredis_cluster.aioredis
but for compatible and migration periodimport aioredis
to import aioredis_cluster.aioredis
because aioredis_cluster
starts vendorize aioredis
package and maintain it separately. Using aioredis
package will be removed in v3aioredic.ConnectionsPool
after Redis node failurexadd_620
commands method for support XADD
options for Redis 6.2+ClusterState.slots_assigned
UncoveredSlotError
execute_timeout
for Manager
ClusterState
by new attributes: state
, state_from
, current_epoch
XREAD
and XREADGROUP
commandsAddress
, ClusterNode
and ClusterState
structs. Available by import from aioredis_cluster import
Cluster
provides some new helpful methods:
get_master_node_by_keys(*keys)
- return master ClusterNode
which contains keys keys
create_pool_by_addr(addr, **kwargs)
- create connection pool by addr
and return pool wrapped by commands_factory
from Cluster
constructor. By default is aioredis_cluster.RedisCluster
instance.get_cluster_state()
- return ClusterState
instance with recent known cluster state received from Redis clusterextract_keys(command_sequence)
- returns keys of command sequencepytest-aiohttp
plugin for testspytest-asyncio
dependency for testsasynctest
-> mock
library for aio testsattrs
dependency. For Python 3.6 you need install dataclasses
BLPOP
/BRPOP
commandsZUNION
, ZINTER
, ZDIFF
, ZUNIONSTORE
, ZINTERSTORE
, ZDIFFSTORE
commandsBLPOP
, BRPOP
, BRPOPLPUSH
, BLMOVE
, BLMPOP
, BZPOPMIN
, BZPOPMAX
, XREAD
, XREADGROUP
state_reload_frequency
from ClusterManager
. state_reload_interval
now is one relevant option for state auto reloadstate_reload_interval
increased and now is 300 seconds (5 minutes)idle_connection_timeout
now is 10 minutesaioredis.locks.Lock
issue (https://github.com/aio-libs/aioredis/pull/802, bpo32734)aioredis_cluster.Cluster
do not acquire dedicate connection for every executeaioredis_cluster
now requires python>=3.6.5
async_timeout
aioredis
dependency bound now is aioredis >=1.1.0, <2.0.0
attempt_timeout
for configure command execution timeout, default timeout is 5 secondsstate_reload_frequency
option to configure state reload frequencystate_reload_interval
option to configure state auto reload intervalfollow_cluster
option enable load cluster state from previous cluster state nodeskeys_master
and all_masters
methods now try to ensure cluster state instead simply raise exception if connection lost to cluster node, for examplemax_attempts
always defaults fixFAQs
Redis Cluster support extension for aioredis
We found that aioredis-cluster demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.