Open
Description
Version:
redis-py 5.0.0
Redis 6.2.6
python 3.11
Description:
I am using Amazon ElastiCache for Redis. After the execution of the maintenance window for Amazon ElastiCache for Redis, exceptions such as
redis.exceptions.RedisClusterException: Redis Cluster cannot be connected. Please provide at least one reachable node: Timeout connecting to server
and
redis.exceptions.ConnectionError: Connection closed by server.
were thrown.
I suspect that the cause was the failure of name resolution because the node's IP was changed after the execution of the maintenance window. Does anyone know a good solution to this issue?
Currently, I have globally defined the client as follows and am using it in various functions.
r = RedisCluster(
host='xxx',
port='yyy',
encoding="utf-8",
decode_responses=True,
)
def sample1():
r.set('foo', 'bar')
def sample2():
r.get('foo')